;;;Karajordanoff's Angle Trisection Scheme ;;;Karajordanoff published in 1928 ;;; ;;;Karajordanoff.LSP ;;;May 17,2006 by Takaya Iwamoto ;;; (defun C:Karajordanoff() (setup_Karajordanoff) ;;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) (setq last_arc (entlast)) ;;divide this arc into 2 parts (command "_.divide" last_arc 2) ;;find the point C (setq pnt_c (cdr (assoc 10 (entget (entlast))))) (make_pt "0" 2 pnt_c) (mark_id pnt_c "C" 1 0.1) ;;draw a tangent line at point A. (normal_from_line pnt_a pnt_org pnt_a 8) ;;find D --intersection of BC and this tangent line ;;find end points of this tangent (setq pnt_end (cdr (assoc 11 (entget (entlast))))) (setq pnt_d (inters pnt_b pnt_c pnt_a pnt_end nil)) (make_pt "0" 2 pnt_d) (mark_id pnt_d "D" 2 0.1) (make_line_1 "0" 8 pnt_b pnt_d) ;;y-coordinate value of point D is h (setq h (cadr pnt_d) x_pos (sqrt (- 4 (* h h))) pnt_t (list x_pos h) ) (make_line_1 "0" 8 pnt_d pnt_t) (make_pt "0" 1 pnt_t) (mark_id pnt_t "T" 1 0.1) ;;line OT is the trisecting line (make_line_1 "0" 2 pnt_org pnt_t) (command "_.zoom" "_Extent") (command "_.regen") (reset_sysvar) );;;DURER ;;; ;;; (defun setup_karajordanoff() (setup_sysvar) (setvar "PDMODE" 32) (setvar "PDSIZE" -3) (setq pnt_org '(0 0) pnt_b '(1 0) pnt_br '(2 0) pnt_g '(-1 0) pnt_gl '(-2 0) y_up '(0 2) chr_size 0.1 chr_size2 0.08 chr_size3 0.06 sqrt_3 (sqrt 3.) ) ;;draw reference lines (make_line_1 "0" 8 y_up pnt_org) (make_line_1 "0" 8 pnt_g pnt_br) ;;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) ;;draw 2 semi circles (make_arc_cbe "0" 8 pnt_org pnt_b pnt_g) (make_arc_cbe "0" 8 pnt_org pnt_br y_up) (command "_.zoom" "_Extent") (command "_.regen") );;;setup_Karajordanoff ;;; ;;;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 2 er_list nil) (while (<= (setq cur_val (+ start_val (* (- nstep 1) step_val))) end_val) (setq th (dtr cur_val) th (* 0.5 th) sine (sin th) cosine (cos th) cos2 (cos (* 2. th)) c1 (* sine (- 1 cos2) ) c2 (* 2 (- cosine cos2)) arg (/ c1 c2) tri_th (rtd (asin 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