;;;Kopf_Perron's Angle Trisection Scheme ;;;Kopf published in 1919 ;;; ;;;Kopf_Perron.LSP ;;;May 18,2006 by Takaya Iwamoto ;;; (defun C:Kopf_Perron() (setup_Kopf_Perron) ;;define angle (setvar "OSMODE" 512) ;; nearest mode (setq pnt_a(getpoint pnt_org "\nDefine an angle Theta")) (make_pt "0" 1 pnt_a) (mark_id pnt_a "A" 2 0.1) (make_line_1 "0" 3 pnt_a pnt_org) (setvar "OSMODE" 0) ;;reset Snap mode to zero (command "_.delay" 1000) ;;Draw an arc (make_arc_cbe "0" 4 pnt_org pnt_b pnt_a) ;;draw line CA (make_line_1 "0" 8 pnt_c pnt_a) (setq line_ca (entlast)) ;;extend line CA to intersect the arc at A' (command "_.extend" last_arc "" pnt_a "") (setq pnt_t (cdr (assoc 11 (entget (entlast))))) (make_line_1 "0" 2 pnt_p pnt_t) (make_pt "0" 1 pnt_t) (mark_id pnt_t "T" 1 0.1) ;;line PT is the trisecting line (command "_.zoom" "_Extent") (command "_.regen") (reset_sysvar) );;;C:Kopf_Perron ;;; ;;; (defun setup_kopf_Perron() (setup_sysvar) (setvar "PDMODE" 32) (setvar "PDSIZE" -3) (setq sqrt_3 (sqrt 3.) pnt_org '(0 0) pnt_b '(1 0) pnt_c '(-1 0) pnt_d '(-0.5 0) pnt_e (list -0.5 (* 0.5 sqrt_3)) pnt_p '(-2 0) y_up '(0 1.5) chr_size 0.1 chr_size2 0.08 chr_size3 0.06 len_de (distance pnt_d pnt_e) len_df (/ len_de 3.) pnt_f (pld pnt_d pnt_c len_df) len_fb (distance pnt_f pnt_b) ) ;;draw reference lines (make_line_1 "0" 8 y_up pnt_org) (make_line_1 "0" 8 pnt_p pnt_b) (make_line_1 "0" 8 pnt_d pnt_e) ;;draw key points (make_pt "0" 0 pnt_org) (mark_id pnt_org "O" 4 chr_size) (make_pt "0" 0 pnt_b) (mark_id pnt_b "B" 4 chr_size) (make_pt "0" 0 pnt_c) (mark_id pnt_c "C" 4 chr_size) (make_pt "0" 0 pnt_d) (mark_id pnt_d "D" 4 chr_size) (make_pt "0" 0 pnt_e) (mark_id pnt_e "E" 2 chr_size) (make_pt "0" 0 pnt_f) (mark_id pnt_f "F" 4 chr_size) (make_pt "0" 0 pnt_p) (mark_id pnt_p "P" 4 chr_size) ;;draw a semi circle (make_arc_cbe "0" 8 pnt_org pnt_b pnt_c) (make_arc_cbe "0" 4 pnt_f pnt_b y_up) (setq last_arc (entlast)) (command "_.zoom" "_Extent") (command "_.regen") );;;setup_Kopf_Perron ;;; ;;;FIND_T ;;; (defun find_t() (setq k len_ae m c k_sqr (* k k) m_sqr (* m m) num_1 (* m k_sqr) num_2 (* k (sqrt (+ (* 4 m_sqr) 4 (- k_sqr)))) denom (* 2 (+ m_sqr 1) ) y_sol (/ (+ num_1 num_2) denom) x_sol (+ (* m y_sol) 1. (- (* 0.5 k_sqr))) pnt_t (list x_sol y_sol) ) );;;FIND_T ;;; ;;;DISTANCE_CHECK ;;;check if length AT is the average of BC2, C2C1, C1A ;;; (defun c:distance_check() (setq bc2 (distance pnt_b pnt_c2) c2c1 (distance pnt_c2 pnt_c1) c1a (distance pnt_c1 pnt_a) at (distance pnt_a pnt_t) average (/ (+ bc2 c2c1 c1a) 3.) t_x (car pnt_t) t_y (cadr pnt_t) pnt_td (list (- t_x) t_y) ttd (distance pnt_t pnt_td) ) );;;distance_check ;;; ;;; (prompt "error_table loading") ;;; (defun C:error_table() (setup_sysvar) (setq start_val 0. end_val 90. step_val 10.) (setq cur_val 0. nstep 1) (setq er_list nil) (while (<= (setq cur_val (+ start_val (* (- nstep 1) step_val))) end_val) (setq th (dtr cur_val) m (/ (sin th) (+ 1 (cos th))) f ( / (+ 3 (sqrt 3.)) 6.) m_sqr (* m m) f_sqr (* f f) a (+ m_sqr 1) b (+ m_sqr f) c (+ m_sqr (- (* 2 f)) -1) c1 (sqrt (- (* b b) (* a c))) num (- c1 b) denom a x_0 (/ num denom) y_0 (* m (+ x_0 1)) arg (/ y_0 (+ 2 x_0)) tri_th (rtd (atan arg)) third_th (/ cur_val 3.) error_deg (abs (- third_th tri_th)) error_rad (dtr error_deg) error_in_minsec (angtos error_rad 1 4) output (list nstep cur_val third_th tri_th error_deg error_in_minsec) er_list (append er_list (list (* 3600. error_deg))) nstep (1+ nstep) ) (princ "output= ")(princ output)(terpri) );;;while loop end (reset_sysvar) );;;error_table