;;;rotate a polygon and get area under a ref_point on it. ;;; ;;;cycloid_area.lsp ;;; by Takaya Iwamoto Dec 16 - Dec 31, 2003 ;;; (defun C:cycloid_area() (setup_polygon) (setq rot_entity ref_poly pnt_axis pt_base2 shift_vec (list base_len 0) shift_vec2 (list 0 (* 2.25 ref_rad)) pnt_start start_cen total_rot_angle (- (rtd (* 2. theta))) n_speed 50 n_repeat 10 ncolor 2 pnt_ref1 pnt_ref ) (repeat (1- num_side) (copy_rotate_ent rot_entity pnt_axis pnt_start total_rot_angle n_speed n_repeat ncolor ) (command "_.copy" (entlast) "" pnt_org pnt_org) (setq ref_poly (entlast) pnt_new (rot pnt_axis pnt_ref1 total_rot_angle) ) (grdraw pnt_ref1 pnt_new 2);;;draw a yel line using grdraw (setq pnt_axis (shift_pnt pnt_axis shift_vec) pnt_start (shift_pnt pnt_start shift_vec) rot_entity ref_poly pnt_ref1 pnt_new ) (command "_.delay" 250) );;;repeat loop (command "_.delay" 250) ;;;repeat loop for a ref point and connecting lines (setq pnt_axis pt_base2 pnt_start start_cen pnt_ref1 pt_base1 pnt_old pt_base1 ) (repeat (1- num_side) (setq pnt_new (rot pnt_axis pnt_ref1 total_rot_angle)) (command "_.point" pnt_new) (setq pnt_axis (shift_pnt pnt_axis shift_vec) pnt_start (shift_pnt pnt_start shift_vec) pnt_ref1 pnt_new ) (make_line_1 "0" 2 pnt_old pnt_new) (setq pnt_old pnt_new) );;;repeat loop (command "_.regen") ;;;erase the grdraw vectors ;;;execute the selected program (cond ((= num_side 3) (case_3) ) ((= num_side 4) (case_4) ) ((= num_side 5) (case_5) ) ((= num_side 6) (case_6) ) ((= num_side 7) (case_7) );;;not available ((= num_side 8) (case_8) ) ((= num_side 9) (case_9) );;;not available ((= num_side 10) (case_10) ) (t nil) );;;end of cond (reset_sysvar) );;;TEST1 ;;; ;;;CASE_3 (defun case_3() (princ "case 3") ;;;define all the points (setq pnt_11 pt_base1 pnt_10 pt_base2 pnt_20 (shift_pnt pnt_10 shift_vec) pnt_30 (shift_pnt pnt_20 shift_vec) ;;end of first row pnt_12 (polar pnt_11 (dtr 60.) base_len) pnt_22 (shift_pnt pnt_12 shift_vec) pnt_32 (shift_pnt pnt_22 shift_vec) ;;end of top row pnt_12m (plt pnt_10 pnt_12 0.5) pnt_23m (plt pnt_20 pnt_32 0.5) );;end of points definition ;;draw shaded triangles (setq red_1 (shaded_triangle "layer1" pnt_10 pnt_20 pnt_22) yel_1 (shaded_triangle "layer50" pnt_11 pnt_10 pnt_12m) yel_2 (shaded_triangle "layer42" pnt_10 pnt_22 pnt_12m) grn_1 (shaded_triangle "layer3" pnt_20 pnt_23m pnt_22) grn_2 (shaded_triangle "layer92" pnt_20 pnt_30 pnt_23m) ) (alert "\nMove triangles") (rotate_ent yel_2 pnt_12m pnt_10 180. 100 5 1) (rotate_ent grn_1 pnt_23m pnt_20 -180. 100 5 1) (alert "\These are triangles in three colors. Each color group\nmakes one triangle") ;;;redraw the trace line (setvar "plinewid" 0.02) (command "_.pline" pnt_11 pnt_22 pnt_30 "") (setvar "plinewid" 0.) );;;CASE_3 ;;; ;;;CASE_4 (defun case_4() (princ "case 4") ;;;define all the points (setq pnt_11 pt_base1 pnt_10 pt_base2 pnt_20 (shift_pnt pnt_10 shift_vec) pnt_30 (shift_pnt pnt_20 shift_vec) pnt_40 (shift_pnt pnt_30 shift_vec) ;;end of first row pnt_12 (polar pnt_11 (dtr 90.) base_len) pnt_22 (shift_pnt pnt_12 shift_vec) pnt_32 (shift_pnt pnt_22 shift_vec) pnt_42 (shift_pnt pnt_32 shift_vec) pnt_43 (shift_pnt pnt_42 shift_vec) ;;end of top row pnt_12m (plt pnt_10 pnt_12 0.5) pnt_34m (plt pnt_30 pnt_43 0.5) );;end of points definition ;;draw shaded triangles (setq red_1 (shaded_triangle "layer1" pnt_20 pnt_32 pnt_22) red_2 (shaded_triangle "layer12" pnt_20 pnt_42 pnt_32) yel_1 (shaded_triangle "layer50" pnt_10 pnt_20 pnt_22) yel_2 (shaded_triangle "layer52" pnt_20 pnt_30 pnt_42) grn_1 (shaded_triangle "layer3" pnt_11 pnt_10 pnt_12m) grn_2 (shaded_triangle "layer92" pnt_10 pnt_22 pnt_12m) grn_3 (shaded_triangle "layer94" pnt_30 pnt_40 pnt_34m) grn_4 (shaded_triangle "layer96" pnt_30 pnt_34m pnt_42) ) (alert "\nMove triangles") (rotate_ent grn_2 pnt_12m pnt_10 180. 100 5 1) (rotate_ent grn_4 pnt_34m pnt_30 -180. 100 5 1) (alert "\nmake an exact copy of the whole picture ") ;;;Copy the whole picture to the bottom (setq whole (ssget "C" pnt_cr1 pnt_cr2)) (command "_.copy" whole "" pnt_org pnt_org) (command "_.zoom" "E") (command "_.regen") (alert "\These are triangles in three colors. Each color group\nmakes one square") (setq pt_11 (shift_pnt pnt_11 shift_vec2) pt_10 (shift_pnt pnt_10 shift_vec2) pt_20 (shift_pnt pnt_20 shift_vec2) pt_30 (shift_pnt pnt_30 shift_vec2) pt_40 (shift_pnt pnt_40 shift_vec2) pt_23m (plt pt_10 pt_20 0.5) pt_34m (plt pt_20 pt_30 0.5) ) (command "polygon" num_side "E" pt_11 pt_10) (command "polygon" num_side "E" pt_23m pt_34m) (command "polygon" num_side "E" pt_30 pt_40) (command "_.zoom" "E") (command "_.regen") ;;Now we are ready to move shaded triangles above to make 3 hexagons ;;;Move trianlges slowly (alert "\nMove red triangles to the above row") (move_ent red_1 pnt_20 pt_34m 100 6 1 "0") (move_ent red_2 pnt_20 pt_34m 100 6 1 "0") (rotate_ent red_2 pt_34m pnt_34m 90. 25 5 1) (alert "\nMove yellow triangles to the above row") (move_ent yel_1 pnt_20 pt_40 100 6 1 "0") (move_ent yel_2 pnt_20 pt_40 100 6 1 "0") (rotate_ent yel_2 pt_40 pnt_40 90. 25 5 1) (alert "\nMove green triangles to the above row") (move_ent grn_1 pnt_10 pt_10 100 6 1 "0") (move_ent grn_2 pnt_10 pt_10 100 6 1 "0") (move_ent grn_3 pnt_30 pt_10 100 6 1 "0") (move_ent grn_4 pnt_30 pt_10 100 6 1 "0") (rotate_ent grn_3 pt_10 pnt_10 90. 25 5 1) (rotate_ent grn_4 pt_10 pnt_10 90. 25 5 1) ;;;redraw the trace line (setvar "plinewid" 0.02) (command "_.pline" pnt_11 pnt_22 pnt_32 pnt_42 pnt_40 "") (setvar "plinewid" 0.) );;;CASE_4 ;;; ;;; ;;;CASE_5 (defun case_5() (princ "case 5") ;;;define all the points (setq pnt_11 pt_base1 pnt_10 pt_base2 pnt_20 (shift_pnt pnt_10 shift_vec) pnt_30 (shift_pnt pnt_20 shift_vec) pnt_40 (shift_pnt pnt_30 shift_vec) pnt_50 (shift_pnt pnt_40 shift_vec) ;;end of first row pnt_12 (polar pnt_11 (dtr 108.) base_len) pnt_22 (shift_pnt pnt_12 shift_vec) pnt_32 (shift_pnt pnt_22 shift_vec) pnt_34 (polar pnt_30 (dtr 72.) base_len) pnt_44 (shift_pnt pnt_34 shift_vec) pnt_54 (shift_pnt pnt_44 shift_vec) pnt_23 (polar pnt_20 (dtr 108.) (distance pnt_10 pnt_12) ) pnt_33 (shift_pnt pnt_23 shift_vec) pnt_43 (shift_pnt pnt_33 shift_vec) pnt_53 (shift_pnt pnt_43 shift_vec) pnt_12m (plt pnt_11 pnt_22 0.5) pnt_23m (plt pnt_22 pnt_33 0.5) pnt_34m (plt pnt_33 pnt_44 0.5) pnt_45m (plt pnt_44 pnt_50 0.5) );;end of points definition ;;draw shaded triangles (setq red_1 (shaded_triangle "layer1" pnt_20 pnt_33 pnt_32) red_2 (shaded_triangle "layer12" pnt_20 pnt_30 pnt_33) red_3 (shaded_triangle "layer240" pnt_30 pnt_34 pnt_33) yel_1 (shaded_triangle "layer50" pnt_10 pnt_20 pnt_22) yel_2 (shaded_triangle "layer42" pnt_33 pnt_34 pnt_34m) yel_3 (shaded_triangle "layer40" pnt_30 pnt_44 pnt_34m) yel_4 (shaded_triangle "layer52" pnt_30 pnt_40 pnt_44) grn_1 (shaded_triangle "layer3" pnt_11 pnt_10 pnt_12m) grn_2 (shaded_triangle "layer92" pnt_12m pnt_10 pnt_22) grn_3 (shaded_triangle "layer91" pnt_22 pnt_20 pnt_23m) grn_4 (shaded_triangle "layer90" pnt_23m pnt_32 pnt_33) grn_5 (shaded_triangle "layer93" pnt_40 pnt_45m pnt_44) grn_6 (shaded_triangle "layer94" pnt_40 pnt_50 pnt_45m) ) (alert "\nMove triangles") (rotate_ent grn_2 pnt_12m pnt_10 180. 100 5 1) (rotate_ent grn_4 pnt_23m pnt_23 180. 100 5 1) (rotate_ent grn_5 pnt_45m pnt_44 -180. 100 5 1) (rotate_ent yel_2 pnt_34m pnt_33 -180. 100 5 1) (alert "\nmake an exact copy of the whole picture ") ;;;Copy the whole picture to the bottom (setq whole (ssget "C" pnt_cr1 pnt_cr2)) (command "_.copy" whole "" pnt_org pnt_org) (command "_.zoom" "E") (command "_.regen") (alert "\These are triangles in three colors. Each color group\nmakes one triangle") ;;draw three hexagons (setq pt_11 (shift_pnt pnt_11 shift_vec2) pt_10 (shift_pnt pnt_10 shift_vec2) pt_20 (shift_pnt pnt_20 shift_vec2) pt_30 (shift_pnt pnt_30 shift_vec2) pt_40 (shift_pnt pnt_40 shift_vec2) pt_50 (shift_pnt pnt_50 shift_vec2) ) (command "polygon" num_side "E" pt_11 pt_10) (command "polygon" num_side "E" pt_20 pt_30) (command "polygon" num_side "E" pt_40 pt_50) (command "_.zoom" "E") (command "_.regen") ;;Now we are ready to move shaded triangles above to make 3 hexagons ;;;Move trianlges slowly (alert "\nMove red triangles to the above row") ;(command "_.move" red_1 "" pnt_20 pt_11) ;(command "_.move" red_2 "" pnt_20 pt_11) ;(command "_.move" red_3 "" pnt_30 pt_10) (move_ent red_1 pnt_20 pt_11 100 6 1 "0") (move_ent red_2 pnt_20 pt_11 100 6 1 "0") (move_ent red_3 pnt_30 pt_10 100 6 1 "0") ;(rotate_ent grn_3 pt_10 pnt_10 90. 25 5 1) ;;;Move trianlges slowly (alert "\nMove yellow triangles to the above row") ;(command "_.move" yel_1 "" pnt_20 pt_30) (move_ent yel_1 pnt_20 pt_30 100 6 1 "0") (command "_.move" yel_2 yel_3 "" pnt_30 pt_30) ;(move_ent yel_2 pnt_30 pt_30 100 6 1 "0") (command "_.rotate" yel_2 yel_3 "" pt_30 72.) (command "_.move" yel_4 "" pnt_30 pt_30) (command "_.rotate" yel_4 "" pt_30 72.) ;;;Move trianlges slowly (alert "\nMove green triangles to the above row") (command "_.move" grn_1 grn_2 "" pnt_10 pt_50) (command "_.move" grn_3 grn_4 "" pnt_20 pt_50) (command "_.move" grn_5 grn_6 "" pnt_40 pt_50) (command "_.rotate" grn_5 grn_6 "" pt_50 72.) (command "_.move" grn_7 grn_8 "" pnt_50 pt_50) (command "_.rotate" grn_7 grn_8 "" pt_50 72.) ;;;redraw the trace line (setvar "plinewid" 0.02) (command "_.pline" pnt_11 pnt_22 pnt_33 pnt_44 pnt_50 "") (setvar "plinewid" 0.) );;;CASE_5 ;;; ;;; ;;;CASE_6 (defun case_6() (princ "case 6") ;;;define all the points (setq pnt_11 pt_base1 pnt_10 pt_base2 pnt_20 (shift_pnt pnt_10 shift_vec) pnt_30 (shift_pnt pnt_20 shift_vec) pnt_40 (shift_pnt pnt_30 shift_vec) pnt_50 (shift_pnt pnt_40 shift_vec) pnt_60 (shift_pnt pnt_50 shift_vec) ;;end of first row pnt_12 (polar pnt_11 (dtr 120.) base_len) pnt_22 (shift_pnt pnt_12 shift_vec) pnt_32 (shift_pnt pnt_22 shift_vec) pnt_45 (shift_pnt pnt_12 (list (* 5 base_len) 0)) pnt_55 (shift_pnt pnt_45 shift_vec) pnt_65 (shift_pnt pnt_45 shift_vec) ;;end of second row pnt_12m (plt pnt_11 pnt_22 0.5) pnt_56m (plt pnt_55 pnt_60 0.5) pnt_14 (polar pnt_22 (dtr 60.) base_len) pnt_24 (shift_pnt pnt_14 shift_vec) pnt_34 (shift_pnt pnt_24 shift_vec) pnt_44 (shift_pnt pnt_34 shift_vec) pnt_54 (shift_pnt pnt_44 shift_vec) pnt_24m (plt pnt_22 pnt_24 0.5) pnt_45m (plt pnt_44 pnt_55 0.5) );;end of points definition ;;draw shaded triangles (setq red_1 (shaded_triangle "layer1" pnt_20 pnt_24 pnt_32) red_2 (shaded_triangle "layer12" pnt_30 pnt_34 pnt_44) red_3 (shaded_triangle "layer240" pnt_30 pnt_24 pnt_34) red_4 (shaded_triangle "layer242" pnt_40 pnt_44 pnt_45) yel_1 (shaded_triangle "layer50" pnt_10 pnt_20 pnt_22) yel_2 (shaded_triangle "layer42" pnt_20 pnt_30 pnt_24) yel_3 (shaded_triangle "layer40" pnt_30 pnt_40 pnt_44) yel_4 (shaded_triangle "layer52" pnt_40 pnt_50 pnt_55) grn_1 (shaded_triangle "layer3" pnt_11 pnt_10 pnt_12m) grn_2 (shaded_triangle "layer92" pnt_12m pnt_10 pnt_22) grn_3 (shaded_triangle "layer91" pnt_22 pnt_20 pnt_24m) grn_4 (shaded_triangle "layer90" pnt_24m pnt_32 pnt_24) grn_5 (shaded_triangle "layer93" pnt_44 pnt_45 pnt_45m) grn_6 (shaded_triangle "layer94" pnt_40 pnt_55 pnt_45m) grn_7 (shaded_triangle "layer95" pnt_55 pnt_50 pnt_56m) grn_8 (shaded_triangle "layer96" pnt_50 pnt_60 pnt_56m) ) (alert "\nMove triangles") (rotate_ent grn_2 pnt_12m pnt_10 180. 100 5 1) (rotate_ent grn_4 pnt_24m pnt_24 180. 100 5 1) (rotate_ent grn_5 pnt_45m pnt_44 -180. 100 5 1) (rotate_ent grn_7 pnt_56m pnt_50 -180. 100 5 1) (alert "\nCopy the whole picture to the lower row") (setq whole (ssget "C" pnt_cr1 pnt_cr2)) (command "_.copy" whole "" pnt_org pnt_org) (command "_.zoom" "E") (command "_.regen") ;;;Copy the whole picture to the bottom (alert "\These are triangles in three colors. Each color group\nmakes one triangle") ;;draw three hexagons (setq pt_11 (shift_pnt pnt_11 shift_vec2) pt_10 (shift_pnt pnt_10 shift_vec2) pt_20 (shift_pnt pnt_20 shift_vec2) pt_30 (shift_pnt pnt_30 shift_vec2) pt_40 (shift_pnt pnt_40 shift_vec2) pt_50 (shift_pnt pnt_50 shift_vec2) pt_60 (shift_pnt pnt_60 shift_vec2) pt_23m (plt pt_20 pt_30 0.5) pt_34m (plt pt_30 pt_40 0.5) ) (command "polygon" num_side "E" pt_11 pt_10) (command "polygon" num_side "E" pt_23m pt_34m) (command "polygon" num_side "E" pt_50 pt_60) (command "_.zoom" "E") (command "_.regen") ;;Now we are ready to move shaded triangles above to make 3 hexagons ;;;Move trianlges slowly (alert "\nMove red triangles to the above row") (command "_.move" red_1 "" pnt_20 pt_10) (command "_.rotate" red_1 "" pt_10 60.) (command "_.move" red_2 "" pnt_30 pt_10) (command "_.rotate" red_2 "" pt_10 60.) (command "_.move" red_3 "" pnt_30 pt_10) (command "_.move" red_4 "" pnt_40 pt_10) ;;;Move trianlges slowly (alert "\nMove yellow triangles to the above row") (command "_.move" yel_1 "" pnt_10 pt_23m) (command "_.move" yel_2 "" pnt_24 pt_34m) (command "_.rotate" yel_2 "" pt_34m 180.) (command "_.move" yel_3 "" pnt_44 pt_34m) (command "_.rotate" yel_3 "" pt_34m -120.) (command "_.move" yel_4 "" pnt_40 pt_34m) (command "_.rotate" yel_4 "" pt_34m 60.) ;;;Move trianlges slowly (alert "\nMove green triangles to the above row") (command "_.move" grn_1 grn_2 "" pnt_10 pt_60) (command "_.move" grn_3 grn_4 "" pnt_20 pt_60) (command "_.move" grn_5 grn_6 "" pnt_40 pt_60) (command "_.rotate" grn_5 grn_6 "" pt_60 60.) (command "_.move" grn_7 grn_8 "" pnt_50 pt_60) (command "_.rotate" grn_7 grn_8 "" pt_60 60.) ;;;redraw the trace line (setvar "plinewid" 0.02) (command "_.pline" pnt_11 pnt_22 pnt_24 pnt_44 pnt_55 pnt_60 "") (setvar "plinewid" 0.) );;;CASE_6 ;;; ;;; ;;;CASE_7 (defun case_7() (princ "case 7") );;;CASE_7 ;;; ;;; ;;;CASE_8 (defun case_8() (princ "case 8") ;;;define all the points (setq pnt_11 pt_base1 pnt_10 pt_base2 pnt_20 (shift_pnt pnt_10 shift_vec) pnt_30 (shift_pnt pnt_20 shift_vec) pnt_40 (shift_pnt pnt_30 shift_vec) pnt_50 (shift_pnt pnt_40 shift_vec) pnt_60 (shift_pnt pnt_50 shift_vec) pnt_70 (shift_pnt pnt_60 shift_vec) pnt_80 (shift_pnt pnt_70 shift_vec) ;;end of first row pnt_12 (polar pnt_11 (dtr 135.) base_len) pnt_22 (shift_pnt pnt_12 shift_vec) pnt_32 (shift_pnt pnt_22 shift_vec) pnt_67 (polar pnt_60 (dtr 45.) base_len) pnt_77 (shift_pnt pnt_67 shift_vec) pnt_87 (shift_pnt pnt_77 shift_vec) ;;end of second row pnt_12m (plt pnt_11 pnt_22 0.5) pnt_78m (plt pnt_77 pnt_80 0.5) pnt_23 (polar pnt_22 (dtr 90.) base_len) pnt_33 (shift_pnt pnt_23 shift_vec) pnt_43 (shift_pnt pnt_33 shift_vec) pnt_56 (polar pnt_50 (dtr 67.5) (distance pnt_20 pnt_22)) pnt_66 (shift_pnt pnt_56 shift_vec) pnt_66 (shift_pnt pnt_56 shift_vec) pnt_23m (plt pnt_22 pnt_33 0.5) pnt_67m (plt pnt_66 pnt_77 0.5) pnt_34 (polar pnt_33 (dtr 45.) base_len) pnt_44 (shift_pnt pnt_34 shift_vec) pnt_54 (shift_pnt pnt_44 shift_vec) pnt_64 (shift_pnt pnt_54 shift_vec) pnt_74 (shift_pnt pnt_64 shift_vec) pnt_34m (plt pnt_33 pnt_44 0.5) pnt_56m (plt pnt_64 pnt_66 0.5) );;end of points definition ;;draw shaded triangles RED color code 10, 20, 220, 240 12,22, 222, 232,242 (setq red_1 (shaded_triangle "layer1" pnt_20 pnt_33 pnt_32) red_2 (shaded_triangle "layer12" pnt_30 pnt_44 pnt_43) red_3 (shaded_triangle "layer240" pnt_40 pnt_54 pnt_44) red_4 (shaded_triangle "layer242" pnt_40 pnt_64 pnt_54) red_5 (shaded_triangle "layer230" pnt_50 pnt_56 pnt_64) red_6 (shaded_triangle "layer232" pnt_60 pnt_67 pnt_66) yel_1 (shaded_triangle "layer50" pnt_10 pnt_20 pnt_22) yel_2 (shaded_triangle "layer42" pnt_20 pnt_30 pnt_33) yel_3 (shaded_triangle "layer40" pnt_30 pnt_40 pnt_44) yel_4 (shaded_triangle "layer52" pnt_40 pnt_50 pnt_64) yel_5 (shaded_triangle "layer40" pnt_50 pnt_60 pnt_66) yel_6 (shaded_triangle "layer52" pnt_60 pnt_70 pnt_77) grn_1 (shaded_triangle "layer3" pnt_11 pnt_10 pnt_12m) grn_2 (shaded_triangle "layer92" pnt_12m pnt_10 pnt_22) grn_3 (shaded_triangle "layer91" pnt_22 pnt_20 pnt_23m) grn_4 (shaded_triangle "layer90" pnt_23m pnt_32 pnt_33) grn_5 (shaded_triangle "layer93" pnt_33 pnt_30 pnt_34m) grn_6 (shaded_triangle "layer94" pnt_43 pnt_44 pnt_34m) grn_7 (shaded_triangle "layer95" pnt_64 pnt_56 pnt_56m) grn_8 (shaded_triangle "layer96" pnt_50 pnt_66 pnt_56m) grn_9 (shaded_triangle "layer93" pnt_66 pnt_67 pnt_67m) grn_10 (shaded_triangle "layer94" pnt_60 pnt_77 pnt_67m) grn_11 (shaded_triangle "layer95" pnt_77 pnt_70 pnt_78m) grn_12 (shaded_triangle "layer96" pnt_70 pnt_80 pnt_78m) ) (alert "\nMove triangles") (rotate_ent grn_2 pnt_12m pnt_10 180. 100 5 1) (rotate_ent grn_4 pnt_23m pnt_32 180. 100 5 1) (rotate_ent grn_6 pnt_34m pnt_44 180. 100 5 1) (rotate_ent grn_7 pnt_56m pnt_50 -180. 100 5 1) (rotate_ent grn_9 pnt_67m pnt_50 -180. 100 5 1) (rotate_ent grn_11 pnt_78m pnt_50 -180. 100 5 1) (alert "\nCopy the whole picture to the lower row") (setq whole (ssget "C" pnt_cr1 pnt_cr2)) (command "_.copy" whole "" pnt_org pnt_org) (command "_.zoom" "E") (command "_.regen") ;;;Copy the whole picture to the bottom (alert "\These are triangles in three colors. Each color group\nmakes one triangle") ;;draw three hexagons (setq pt_11 (shift_pnt pnt_11 shift_vec2) pt_10 (shift_pnt pnt_10 shift_vec2) pt_30 (shift_pnt pnt_30 shift_vec2) pt_40 (shift_pnt pnt_40 shift_vec2) pt_50 (shift_pnt pnt_50 shift_vec2) pt_70 (shift_pnt pnt_70 shift_vec2) pt_80 (shift_pnt pnt_80 shift_vec2) pt_34m (plt pt_30 pt_40 0.5) pt_45m (plt pt_40 pt_50 0.5) ) (command "polygon" num_side "E" pt_11 pt_10) (command "polygon" num_side "E" pt_34m pt_45m) (command "polygon" num_side "E" pt_70 pt_80) (command "_.zoom" "E") (command "_.regen") (make_jpg) (make_jpg) ;;Now we are ready to move shaded triangles above to make 3 hexagons ;;;Move trianlges slowly (alert "\nMove red triangles to the above row") (move_ent red_1 pnt_20 pt_10 100 6 1 "0") (rotate_ent red_1 pt_10 pnt_10 45. 25 5 1) (move_ent red_2 pnt_30 pt_10 100 6 1 "0") (rotate_ent red_2 pt_10 pnt_10 45. 25 5 1) (move_ent red_4 pnt_40 pt_10 100 6 1 "0") (rotate_ent red_4 pt_10 pnt_10 45. 25 5 1) (move_ent red_3 pnt_40 pt_10 100 6 1 "0") (move_ent red_5 pnt_50 pt_10 100 6 1 "0") (move_ent red_6 pnt_60 pt_10 100 6 1 "0") (make_jpg) (make_jpg) ;;;Move trianlges slowly (alert "\nMove yellow triangles to the above row") (move_ent yel_1 pnt_22 pt_45m 100 6 1 "0") (rotate_ent yel_1 pt_45m pnt_10 90. 25 5 1) (move_ent yel_2 pnt_33 pt_45m 100 6 1 "0") (rotate_ent yel_2 pt_45m pnt_10 135. 25 5 1) (move_ent yel_3 pnt_44 pt_45m 100 6 1 "0") (rotate_ent yel_3 pt_45m pnt_10 180. 25 5 1) (move_ent yel_4 pnt_64 pt_45m 100 6 1 "0") (rotate_ent yel_4 pt_45m pnt_10 -135. 25 5 1) (move_ent yel_5 pnt_66 pt_45m 100 6 1 "0") (rotate_ent yel_5 pt_45m pnt_10 -90. 25 5 1) (move_ent yel_6 pnt_77 pt_45m 100 6 1 "0") (rotate_ent yel_6 pt_45m pnt_10 -45. 25 5 1) (make_jpg) (make_jpg) ;;;Move trianlges slowly (alert "\nMove green triangles to the above row") (setq grn_1_2 (ssadd)) (ssadd grn_1 grn_1_2) (ssadd grn_2 grn_1_2) (setq grn_34 (ssadd)) (ssadd grn_3 grn_34) (ssadd grn_4 grn_34) (setq grn_56 (ssadd)) (ssadd grn_5 grn_56) (ssadd grn_6 grn_56) (setq grn_78 (ssadd)) (ssadd grn_7 grn_78) (ssadd grn_8 grn_78) (setq grn_91 (ssadd)) (ssadd grn_9 grn_91) (ssadd grn_10 grn_91) (setq grn_1112 (ssadd)) (ssadd grn_11 grn_1112) (ssadd grn_12 grn_1112) (move_ent grn_1_2 pnt_10 pt_80 100 6 1 "0") (move_ent grn_34 pnt_20 pt_80 100 6 1 "0") (move_ent grn_56 pnt_30 pt_80 100 6 1 "0") (move_ent grn_78 pnt_50 pt_80 100 6 1 "0") (rotate_ent grn_78 pt_80 pnt_10 45. 25 5 1) (move_ent grn_91 pnt_60 pt_80 100 6 1 "0") (rotate_ent grn_91 pt_80 pnt_10 45. 25 5 1) (move_ent grn_1112 pnt_70 pt_80 100 6 1 "0") (rotate_ent grn_1112 pt_80 pnt_10 45. 25 5 1) ;;;redraw the trace line (setvar "plinewid" 0.02) (command "_.pline" pnt_11 pnt_22 pnt_33 pnt_44 pnt_54 pnt_64 pnt_66 pnt_77 pnt_80 "") (setvar "plinewid" 0.) (make_jpg) (make_jpg) (make_jpg) );;;CASE_8 ;;; ;;; ;;;CASE_9 (defun case_9() (princ "case 9") );;;CASE_9 ;;; ;;; ;;;CASE_10 (defun case_10() (princ "case 10") ;;;define all the points (setq pnt_11 pt_base1 pnt_10 pt_base2 pnt_20 (shift_pnt pnt_10 shift_vec) pnt_30 (shift_pnt pnt_20 shift_vec) pnt_40 (shift_pnt pnt_30 shift_vec) pnt_50 (shift_pnt pnt_40 shift_vec) pnt_60 (shift_pnt pnt_50 shift_vec) pnt_70 (shift_pnt pnt_60 shift_vec) pnt_80 (shift_pnt pnt_70 shift_vec) pnt_90 (shift_pnt pnt_80 shift_vec) pnt_100 (shift_pnt pnt_90 shift_vec) ;;end of first row pnt_12 (polar pnt_11 (dtr 144.) base_len) pnt_22 (shift_pnt pnt_12 shift_vec) pnt_32 (shift_pnt pnt_22 shift_vec) pnt_89 (polar pnt_80 (dtr 36.) base_len) pnt_99 (shift_pnt pnt_89 shift_vec) pnt_109 (shift_pnt pnt_99 shift_vec) ;;end of second row pnt_12m (plt pnt_11 pnt_22 0.5) pnt_91m (plt pnt_99 pnt_100 0.5) pnt_23 (polar pnt_22 (dtr 108.) base_len) pnt_33 (shift_pnt pnt_23 shift_vec) pnt_43 (shift_pnt pnt_33 shift_vec) pnt_78 (polar pnt_70 (dtr 54.) (distance pnt_20 pnt_22)) pnt_88 (shift_pnt pnt_78 shift_vec) pnt_98 (shift_pnt pnt_88 shift_vec) pnt_23m (plt pnt_22 pnt_33 0.5) pnt_89m (plt pnt_88 pnt_99 0.5) pnt_34 (polar pnt_33 (dtr 72.) base_len) pnt_44 (shift_pnt pnt_34 shift_vec) pnt_54 (shift_pnt pnt_44 shift_vec) pnt_67 (polar pnt_60 (dtr 72.) (distance pnt_30 pnt_44)) pnt_77 (shift_pnt pnt_67 shift_vec) pnt_87 (shift_pnt pnt_77 shift_vec) pnt_34m (plt pnt_33 pnt_44 0.5) pnt_78m (plt pnt_77 pnt_88 0.5) pnt_45 (polar pnt_44 (dtr 36.) base_len) pnt_55 (shift_pnt pnt_45 shift_vec) pnt_65 (shift_pnt pnt_55 shift_vec) pnt_75 (shift_pnt pnt_65 shift_vec) pnt_85 (shift_pnt pnt_75 shift_vec) pnt_45m (plt pnt_44 pnt_55 0.5) pnt_67m (plt pnt_75 pnt_77 0.5) );;end of points definition ;;draw shaded triangles RED color code 10, 20, 220, 240 12,22, 222, 232,242 (setq red_1 (shaded_triangle "layer1" pnt_20 pnt_33 pnt_32) red_2 (shaded_triangle "layer12" pnt_30 pnt_44 pnt_43) red_3 (shaded_triangle "layer240" pnt_40 pnt_55 pnt_54) red_4 (shaded_triangle "layer242" pnt_50 pnt_65 pnt_55) red_5 (shaded_triangle "layer230" pnt_50 pnt_75 pnt_65) red_6 (shaded_triangle "layer232" pnt_60 pnt_67 pnt_75) red_7 (shaded_triangle "layer1" pnt_70 pnt_78 pnt_77) red_8 (shaded_triangle "layer12" pnt_80 pnt_89 pnt_88) yel_1 (shaded_triangle "layer50" pnt_10 pnt_20 pnt_22) yel_2 (shaded_triangle "layer42" pnt_20 pnt_30 pnt_33) yel_3 (shaded_triangle "layer40" pnt_30 pnt_40 pnt_44) yel_4 (shaded_triangle "layer52" pnt_40 pnt_50 pnt_55) yel_5 (shaded_triangle "layer40" pnt_50 pnt_60 pnt_75) yel_6 (shaded_triangle "layer52" pnt_60 pnt_70 pnt_77) yel_7 (shaded_triangle "layer50" pnt_70 pnt_80 pnt_88) yel_8 (shaded_triangle "layer42" pnt_80 pnt_90 pnt_99) grn_1 (shaded_triangle "layer3" pnt_11 pnt_10 pnt_12m) grn_2 (shaded_triangle "layer92" pnt_12m pnt_10 pnt_22) grn_3 (shaded_triangle "layer91" pnt_22 pnt_20 pnt_23m) grn_4 (shaded_triangle "layer90" pnt_23m pnt_32 pnt_33) grn_5 (shaded_triangle "layer93" pnt_33 pnt_30 pnt_34m) grn_6 (shaded_triangle "layer94" pnt_43 pnt_44 pnt_34m) grn_7 (shaded_triangle "layer93" pnt_44 pnt_40 pnt_45m) grn_8 (shaded_triangle "layer94" pnt_45m pnt_54 pnt_55) grn_9 (shaded_triangle "layer95" pnt_75 pnt_67 pnt_67m) grn_10 (shaded_triangle "layer96" pnt_60 pnt_77 pnt_67m) grn_11 (shaded_triangle "layer93" pnt_77 pnt_78 pnt_78m) grn_12 (shaded_triangle "layer94" pnt_70 pnt_88 pnt_78m) grn_13 (shaded_triangle "layer95" pnt_88 pnt_89 pnt_89m) grn_14 (shaded_triangle "layer96" pnt_80 pnt_99 pnt_89m) grn_15 (shaded_triangle "layer95" pnt_99 pnt_90 pnt_91m) grn_16 (shaded_triangle "layer96" pnt_90 pnt_100 pnt_91m) ) ;(exit);;;debugging (alert "\nMove triangles") (rotate_ent grn_2 pnt_12m pnt_10 180. 100 5 1) (rotate_ent grn_4 pnt_23m pnt_32 180. 100 5 1) (rotate_ent grn_6 pnt_34m pnt_43 180. 100 5 1) (rotate_ent grn_8 pnt_45m pnt_54 180. 100 5 1) (rotate_ent grn_9 pnt_67m pnt_75 -180. 100 5 1) (rotate_ent grn_11 pnt_78m pnt_77 -180. 100 5 1) (rotate_ent grn_13 pnt_89m pnt_88 -180. 100 5 1) (rotate_ent grn_15 pnt_91m pnt_99 -180. 100 5 1) (alert "\nCopy the whole picture to the lower row") (setq whole (ssget "C" pnt_cr1 pnt_cr2)) (command "_.copy" whole "" pnt_org pnt_org) (command "_.zoom" "E") (command "_.regen") ;;;Copy the whole picture to the bottom (alert "\These are triangles in three colors. Each color group\nmakes one triangle") ;;draw three hexagons (setq pt_11 (shift_pnt pnt_11 shift_vec2) pt_10 (shift_pnt pnt_10 shift_vec2) pt_40 (shift_pnt pnt_40 shift_vec2) pt_50 (shift_pnt pnt_50 shift_vec2) pt_60 (shift_pnt pnt_60 shift_vec2) pt_90 (shift_pnt pnt_90 shift_vec2) pt_100 (shift_pnt pnt_100 shift_vec2) pt_45m (plt pt_40 pt_50 0.5) pt_56m (plt pt_50 pt_60 0.5) ) (command "polygon" num_side "E" pt_11 pt_10) (command "polygon" num_side "E" pt_45m pt_56m) (command "polygon" num_side "E" pt_90 pt_100) (command "_.zoom" "E") (command "_.regen") ;;Now we are ready to move shaded triangles above to make 3 decagons ;;;Move trianlges slowly (alert "\nMove red triangles to the above row") (move_ent red_1 pnt_20 pt_10 100 6 1 "0") (rotate_ent red_1 pt_10 pnt_10 36. 25 5 1) (move_ent red_2 pnt_30 pt_10 100 6 1 "0") (rotate_ent red_2 pt_10 pnt_10 36. 25 5 1) (move_ent red_3 pnt_40 pt_10 100 6 1 "0") (rotate_ent red_3 pt_10 pnt_10 36. 25 5 1) (move_ent red_5 pnt_50 pt_10 100 6 1 "0") (rotate_ent red_5 pt_10 pnt_10 36. 25 5 1) (move_ent red_4 pnt_50 pt_10 100 6 1 "0") (move_ent red_6 pnt_60 pt_10 100 6 1 "0") (move_ent red_7 pnt_70 pt_10 100 6 1 "0") (move_ent red_8 pnt_80 pt_10 100 6 1 "0") ;;;Move trianlges slowly (alert "\nMove yellow triangles to the above row") (move_ent yel_1 pnt_22 pt_56m 100 6 1 "0") (rotate_ent yel_1 pt_56m pnt_10 72. 25 5 1) (move_ent yel_2 pnt_33 pt_56m 100 6 1 "0") (rotate_ent yel_2 pt_56m pnt_10 108. 25 5 1) (move_ent yel_3 pnt_44 pt_56m 100 6 1 "0") (rotate_ent yel_3 pt_56m pnt_10 144. 25 5 1) (move_ent yel_4 pnt_55 pt_56m 100 6 1 "0") (rotate_ent yel_4 pt_56m pnt_10 -180. 25 5 1) (move_ent yel_5 pnt_75 pt_56m 100 6 1 "0") (rotate_ent yel_5 pt_56m pnt_10 -144. 25 5 1) (move_ent yel_6 pnt_77 pt_56m 100 6 1 "0") (rotate_ent yel_6 pt_56m pnt_10 -108. 25 5 1) (move_ent yel_7 pnt_88 pt_56m 100 6 1 "0") (rotate_ent yel_7 pt_56m pnt_10 -72. 25 5 1) (move_ent yel_8 pnt_99 pt_56m 100 6 1 "0") (rotate_ent yel_8 pt_56m pnt_10 -36. 25 5 1) ;;;Move trianlges slowly (alert "\nMove green triangles to the above row") (setq grn_1_2 (ssadd)) (ssadd grn_1 grn_1_2) (ssadd grn_2 grn_1_2) (setq grn_34 (ssadd)) (ssadd grn_3 grn_34) (ssadd grn_4 grn_34) (setq grn_56 (ssadd)) (ssadd grn_5 grn_56) (ssadd grn_6 grn_56) (setq grn_78 (ssadd)) (ssadd grn_7 grn_78) (ssadd grn_8 grn_78) (setq grn_91 (ssadd)) (ssadd grn_9 grn_91) (ssadd grn_10 grn_91) (setq grn_1112 (ssadd)) (ssadd grn_11 grn_1112) (ssadd grn_12 grn_1112) (setq grn_1314 (ssadd)) (ssadd grn_13 grn_1314) (ssadd grn_14 grn_1314) (setq grn_1516 (ssadd)) (ssadd grn_15 grn_1516) (ssadd grn_16 grn_1516) (move_ent grn_1_2 pnt_10 pt_100 100 6 1 "0") (move_ent grn_34 pnt_20 pt_100 100 6 1 "0") (move_ent grn_56 pnt_30 pt_100 100 6 1 "0") (move_ent grn_78 pnt_40 pt_100 100 6 1 "0") (move_ent grn_91 pnt_60 pt_100 100 6 1 "0") (rotate_ent grn_91 pt_100 pnt_10 36. 25 5 1) (move_ent grn_1112 pnt_70 pt_100 100 6 1 "0") (rotate_ent grn_1112 pt_100 pnt_10 36. 25 5 1) (move_ent grn_1314 pnt_80 pt_100 100 6 1 "0") (rotate_ent grn_1314 pt_100 pnt_10 36. 25 5 1) (move_ent grn_1516 pnt_90 pt_100 100 6 1 "0") (rotate_ent grn_1516 pt_100 pnt_10 36. 25 5 1) ;;;redraw the trace line (setvar "plinewid" 0.02) (command "_.pline" pnt_11 pnt_22 pnt_33 pnt_44 pnt_55 pnt_65 pnt_75 pnt_77 pnt_88 pnt_99 pnt_100 "") (setvar "plinewid" 0.) );;;CASE_10 ;;; ;;; (defun setup_polygon() (setup_sysvar) (setvar "PDMODE" 32) (setq y_up '(0 2) y_down '(0 -0.1) ref_rad 1.0 pnt_org '(0 0) num_side (getint "\nNumber of sides in polygon (3,4,5 6, 8 or 10)(def. 8)") ) (if (= num_side nil) (setq num_side 8)) (setq theta (/ pi num_side) base_len (* 2. ref_rad (sin theta)) x_left '(-1 0) x_right (list (* base_len (1+ num_side)) 0) pt_base1 (list (- (* ref_rad (sin theta))) 0) pt_base2 (list (* ref_rad (sin theta)) 0) rad_height (* ref_rad (cos theta)) start_cen (list 0 rad_height) pnt_ref pt_base1 pnt_cr1 (shift_pnt x_right '(2 2)) pnt_cr2 x_left ) (make_line_1 "0" 8 x_left x_right) (make_line_1 "0" 8 y_down y_up) (command "_.point" pnt_ref) (setq point_ref (entlast)) (command "polygon" num_side "E" pt_base1 pt_base2) (command "_.zoom" "E") (command "_.regen") (command "_.copy" (entlast) "" pnt_org pnt_org) (setq ref_poly (entlast)) (make_jpg) (make_jpg) );;;SETUP_POLYGON