;;;Archytas's 3D solid solution to Delian Problem ;;;This is the first and only 3D approach ;;;File name : Archytas_Delian.lsp ;;; ;;; ;;;Jan 15,2006 Takaya Iwamoto ;;;modification records ;;; jan 16,2006 clean up ;;; jan 17,2006 two commands Archytas_Delian & Archytas_Delian_Model ;;; Full cone is needed for smooth UNION execution. ;;; jan 18,2006 Finishing touch to Archytas_Delian command ;;; ;;;Prototype Archytas_Delian_0 ;;; (defun c:Archytas_Delian_0() ;draw base circle and generator line for Cone (setup_archytas) ;create a cylinder with color yellow(2) (alert "\nCreate a cylinder") (setvar "CECOLOR" "2") (command "_.cylinder" cylinder_center cylinder_rad cylinder_length) (setq cylinder_1 (entlast)) ;Create a torus with zero inner radius (alert "\nCreate a torus with zero inner radius") (setvar "CECOLOR" "4") (command "_.torus" torus_center torus_rad tube_rad) (setq torus_1 (entlast)) ;Create a right cone first on X-Y plane and rotate it 90 degrees ;about the line connecting points C & D so that the center line ;will coincide with X-axis (line AC) (alert "\nCreate a cylinder whose generator line is AD") (setvar "CECOLOR" "6") 'magenta color (command "_.cone" pnt_c cone_base_rad cone_height) (setq cone_1 (entlast)) (alert "\nRotate this cone about line CD by 90 degrees") (command "_.rotate3d" cone_1 "" "2" pnt_d pnt_c 90.) ;shade this shademode Gouroud shading (command "_.shade" ) ;Take union of 3 solids (reset_sysvar) ) ;;; ;;; ;;;Archytas_Delian ;;;Solve the Delian problem by taking intersections of 3 solids ;;; Torus, Cylinder & Cone ;;; ;;; (defun c:Archytas_Delian() ;draw base circle and generator line for Cone (setup_archytas) ;;;create a cylinder with color yellow(2) (alert "\nCreate a semi circle with diameter AC \nand create extrusion in Z-direction") (setvar "CECOLOR" "2") (command "_.pline" pnt_az pnt_cz "_A" "_CE" pnt_oz pnt_az "") (setq semi_circle_1 (entlast)) (command "_.extrude" semi_circle_1 "" cylinder_height extrusion_angle) (setq cylinder_1 (entlast)) ;;;Create a torus with zero inner radius (alert "\nCreate a quadrant of torus with zero inner radius \nby rotating a semi circle around Z-axis") (setvar "CECOLOR" "4") (command "_.pline" pnt_a pnt_c "_A" "_CE" pnt_o pnt_a "") (setq semi_circle_2 (entlast)) (command "_.rotate3d" semi_circle_2 "" "2" pnt_a pnt_c 90.) (setq torus_base (entlast)) (command "_.revolve" torus_base "" "_O" zaxis_line 90.) (setq torus_1 (entlast)) ;;;Create a right cone first on X-Y plane and rotate it 90 degrees ;about the line connecting points C & D so that the center line ;will coincide with X-axis (line AC) (alert "\nCreate a cylinder whose generator line is AD") (setvar "CECOLOR" "6") :magenta color (command "_.pline" pnt_a pnt_d pnt_c "cl") (setq cone_base (entlast)) (command "_.revolve" cone_base "" "X" 360.) ;(command "_.revolve" cone_base "" "X" 100.) (setq cone_1 (entlast)) (setvar "CECOLOR" "1") ;color red ;(alert "\nRotate this cone about line CD by 90 degrees") ;(command "_.rotate3d" cone_1 "" "2" pnt_d pnt_c 360.) ;shade this shademode Gouroud shading ;(command "_.shade" ) ;Take union of 3 solids (alert "\nTake union of these 3 solids") (command "_.union" cylinder_1 torus_1 cone_1 "") ;;;;result display ;;;point of intersection is (set LUPREC=8) ;;;X=0.79370053 Y=0.97848890 Z=0.96562987 (setq pnt_p (list 0.79370053 0.97848890 0.96562987) pnt_m (list 0.79370053 0.97848890 0) pnt_n (inters pnt_a pnt_m pnt_b pnt_e) pnt_c_dash (pld pnt_a pnt_m 2.0) pnt_d_dash (list (car pnt_c_dash) (cadr pnt_c_dash) sqrt_3) dist_en (distance pnt_e pnt_n) dist_nb (distance pnt_n pnt_b) height_qn (sqrt (* dist_en dist_nb)) pnt_q (list (car pnt_n) (cadr pnt_n) height_qn) pnt_ac_m (plt pnt_a pnt_c_dash 0.5) pnt_eb_m (plt pnt_e pnt_b 0.5) ) ;;;display grid symbol (setvar "CECOLOR" "0") (command "_.point" pnt_p ) (command "_.point" pnt_m ) (command "_.point" pnt_b ) (command "_.point" pnt_a ) (command "_.point" pnt_q ) (command "_.point" pnt_n ) (command "_.point" pnt_c ) (command "_.point" pnt_e ) (command "_.point" pnt_c_dash ) ;draw two semi-circles and rotate them 90. degrees vertical to x-y plane (alert "\nDraw two semi-circles and rotate them 90 degrees") (command "_.arc" pnt_a "C" pnt_ac_m "A" 180.) (setq arc_1 (entlast)) (command "_.rotate3d" arc_1 "" "2" pnt_c_dash pnt_a 90.) (command "_.arc" pnt_e "C" pnt_eb_m "A" 180.) (setq arc_2 (entlast)) (command "_.rotate3d" arc_2 "" "2" pnt_b pnt_e 90.) ;draw lines (setvar "CECOLOR" "8") (make_line_1 "0" 8 pnt_e pnt_b) (make_line_1 "0" 8 pnt_a pnt_c_dash) (make_line_1 "0" 8 pnt_q pnt_n) (make_line_1 "0" 8 pnt_p pnt_m) (make_line_1 "0" 8 pnt_a pnt_p) ;;;display grid ID (setvar "CECOLOR" "0") (setq tx_height 0.20 tx_angle 35.) (textdisplay "A" '(-0.3153 -0.2512 0.0000) tx_height tx_angle) (textdisplay "B" '(0.5035 0.9521 0.0000) tx_height tx_angle) (textdisplay "C" '(2.2671 -0.1447 0.0000) tx_height tx_angle) (textdisplay "C'" '(1.3664 1.6613 0.0000) tx_height tx_angle) (textdisplay "D" '(1.6772 3.3245 0.0000) tx_height tx_angle) (textdisplay "E" '(0.8218 -1.0746 0.0000) tx_height tx_angle) (textdisplay "M" '(1.0811 0.8171 0.0000) tx_height tx_angle) (textdisplay "N" '(0.7051 0.4042 0.0000) tx_height tx_angle) (textdisplay "P" '(0.3457 1.5785 0.0000) tx_height tx_angle) (textdisplay "Q" '(0.0812 1.2347 0.0000) tx_height tx_angle) (reset_sysvar) ) ;;; ;;; ;;;Archytas_Delian_Model ;;;Show the Model used by Archytas in SOlving Delian Problem ;;; Torus, Cylinder & Cone ;;; ;;; (defun c:Archytas_Delian_Model() ;draw base circle and generator line for Cone (setup_archytas) (setvar "ISOLINES" 500) ;(command "_.vpoint" '(-0.53425870 3.12255144 9.48554285)) ;create a cylinder with color yellow(2) (alert "\nCreate a semi circle with diameter AC \nand create extrusion in Z-direction") (setvar "CECOLOR" "2") (command "_.pline" pnt_az pnt_cz "_A" "_CE" pnt_oz pnt_az "") (setq semi_circle_1 (entlast)) (command "_.extrude" semi_circle_1 "" cylinder_height extrusion_angle) (setq cylinder_1 (entlast)) ;Create a torus with zero inner radius (alert "\nCreate a quadrant of torus with zero inner radius \nby rotating a semi circle around Z-axis") (setvar "CECOLOR" "4") (command "_.pline" pnt_a pnt_c "_A" "_CE" pnt_o pnt_a "") (setq semi_circle_2 (entlast)) (command "_.rotate3d" semi_circle_2 "" "2" pnt_a pnt_c 90.) (setq torus_base (entlast)) (command "_.revolve" torus_base "" "_O" zaxis_line 90.) ; (setq torus_1 (entlast)) ;Create a right cone first on X-Y plane and rotate it 90 degrees ;about the line connecting points C & D so that the center line ;will coincide with X-axis (line AC) (alert "\nCreate a cylinder whose generator line is AD") (setvar "CECOLOR" "6") 'magenta color (command "_.pline" pnt_a pnt_d pnt_c "cl") (setq cone_base (entlast)) (command "_.revolve" cone_base "" "X" 80.) (setq cone_1 (entlast)) ;(alert "\nRotate this cone about line CD by 90 degrees") ;(command "_.rotate3d" cone_1 "" "2" pnt_d pnt_c 360.) ;shade this shademode Gouroud shading ;(command "_.shade" ) ;Take union of 3 solids (reset_sysvar) ) ;;; ;;; (prompt "\nLoading setup_archytas") ;;; (defun setup_archytas() (setup_sysvar) (setvar "FACETRES" 10) ;highest resolution (setvar "LUPREC" 8) ;highest precision (setvar "PDMODE" 32) (setvar "PDSIZE" -2) (setq sqrt_3 (sqrt 3.) 2_sqrt_3 (* 2. sqrt_3) cylinder_rad 1.0 torus_rad 1.0 tube_rad 1.0 torus_center '(0 0 0) extrusion_angle 0. cylinder_height 2. cylinder_center '(1 0 0.01) cone_base_rad 2_sqrt_3 cone_height 2.0 pnt_a '(0 0 0) pnt_c '(2 0 0) pnt_b (list 0.5 (* 0.5 sqrt_3) 0) pnt_d (list 2 2_sqrt_3 0) pnt_e (list 0.5 (* -0.5 sqrt_3) 0) pnt_o (list 1 0 0) pnt_zaxis '(0 0 1.5) pnt_dd (list 2 (- 2_sqrt_3) 0) ;;;these 3 points are used to create ;;;a cylinder which does not have osculation problem ;;;when UNION is taken with the torus. pnt_az '(0 0 0.01) pnt_cz '(2 0 0.01) pnt_oz '(1 0 0.01) ) (make_circle_1 "0" 8 pnt_o 1.0) ;base circle (make_line_1 "0" 8 pnt_a pnt_c) (make_line_1 "0" 0 pnt_a pnt_b) (make_line_1 "0" 8 pnt_b pnt_d) (make_line_1 "0" 8 pnt_c pnt_d) (make_line_1 "0" 0 pnt_a pnt_zaxis) (setq zaxis_line (entlast)) ;;;setup viewing angle (command "_.vpoint" '(3.73135425 -3.92621277 4.49939932)) (command "_.zoom" "_Extent") (command "_.regen") );;;SETUP_ARCHYTAS ;;; (prompt "\nLoading setup_archytas_base") ;;; (defun setup_archytas_base() (setup_sysvar) (setvar "FACETRES" 10) ;highest resolution (setvar "LUPREC" 8) ;highest precision (setvar "PDMODE" 32) (setvar "PDSIZE" -2) (setvar "ISOLINES" 24) (setq sqrt_3 (sqrt 3.) 2_sqrt_3 (* 2. sqrt_3) cylinder_rad 1.0 torus_rad 1.0 tube_rad 1.0 torus_center '(0 0 0) extrusion_angle 0. cylinder_height 2. cylinder_center '(1 0 0.01) cone_base_rad 2_sqrt_3 cone_height 2.0 chr_size 0.25 pnt_a '(0 0 0) pnt_c '(2 0 0) pnt_b (list 0.5 (* 0.5 sqrt_3) 0) pnt_d (list 2 2_sqrt_3 0) pnt_e (list 0.5 (* -0.5 sqrt_3) 0) pnt_o (list 1 0 0) pnt_xaxis '(2.5 0 0) pnt_zaxis '(0 0 1.5) pnt_yaxis '(0 1.5 0) pnt_dd (list 2 (- 2_sqrt_3) 0) ;;;these 3 points are used to create ;;;a cylinder which does not have osculation problem ;;;when UNION is taken with the torus. pnt_az '(0 0 0.01) pnt_cz '(2 0 0.01) pnt_oz '(1 0 0.01) pnt_ar '(8 0 0) pnt_ll '(7 -1 0) pnt_ur '(11 5 0) ) (make_circle_1 "0" 8 pnt_o 1.0) ;base circle (make_line_1 "0" 0 pnt_a pnt_c) (make_line_1 "0" 0 pnt_a pnt_b) (make_line_1 "0" 8 pnt_b pnt_d) (make_line_1 "0" 8 pnt_c pnt_d) (make_line_1 "0" 8 pnt_c pnt_xaxis) (make_line_1 "0" 8 pnt_a pnt_yaxis) (make_line_1 "0" 8 pnt_a pnt_zaxis) (setq zaxis_line (entlast)) ;;display node ID (textdisplay "A" (shift_pnt pnt_a '(-0.25 0) ) chr_size 0.) (textdisplay "B" (shift_pnt pnt_b '(-0.25 0) ) chr_size 0.) (textdisplay "C" pnt_c chr_size 0.) (textdisplay "D" (shift_pnt pnt_d '(0 -0.25) ) chr_size 0.) (textdisplay "x" pnt_xaxis chr_size 0.) (textdisplay "y" pnt_yaxis chr_size 0.) ;(textdisplay "z" '(-1.59377980 1.42524177 0.0) chr_size 0.) (textdisplay "z" '(0 0 2) chr_size 0.) ;;;setup viewing angle (command "_.vpoint" '(3.73135425 -3.92621277 4.49939932)) (command "_.zoom" "_Extent") (command "_.regen") );;;SETUP_ARCHYTAS_BASE ;;; ;;;------------------------draw components----------------------------- ;;;DRAW_Torus ;;; (defun c:draw_torus( ) (setup_archytas_base) ;;Create a torus with zero inner radius (alert "\nCreate a quadrant of torus with zero inner radius \nby rotating a semi circle around Z-axis") (setvar "CECOLOR" "4") (command "_.pline" pnt_a pnt_c "_A" "_CE" pnt_o pnt_a "") (setq semi_circle_2 (entlast)) ;;rotate the semi circle 90 degrees, making it vertical to plane ABC (command "_.rotate3d" semi_circle_2 "" "2" pnt_a pnt_c 90.) (setq torus_base (entlast)) ;;revolve this semi-circle 90 degrees around z-axiz into surface (command "_.revolve" torus_base "" "_O" zaxis_line 90.) (setq torus_1 (entlast)) ;; ;(command "_.vpoint" '(3.73135425 -3.92621277 4.49939932)) (reset_sysvar) ) ;;; ;;; ;;;DRAW_cylinder ;;; (defun c:draw_cylinder( ) (setup_archytas_base) (command "_.delay" 500) ;;create a cylinder with color yellow(2) (alert "\nCreate a semi circle with diameter AC \nand create extrusion in Z-direction") (setvar "CECOLOR" "2") (command "_.pline" pnt_az pnt_cz "_A" "_CE" pnt_oz pnt_az "") (setq semi_circle_1 (entlast)) (command "_.extrude" semi_circle_1 "" cylinder_height extrusion_angle) (setq cylinder_1 (entlast)) ;(command "_.delay" 2000) ;(alert "\nthen shade this") ;(command "_.shademode" "G") (reset_sysvar) ) ;;; ;;; ;;;DRAW_cone ;;; (defun c:draw_cone( ) (setup_archytas_base) ;;;Create a right cone first on X-Y plane and rotate it 90 degrees ;;;about the line connecting points C & D so that the center line ;;;will coincide with X-axis (line AC) (alert "\nCreate a cylinder whose generator line is AD") (setvar "CECOLOR" "6") ;;:magenta color (command "_.pline" pnt_a pnt_d pnt_c "cl") (setq cone_base (entlast)) (command "_.revolve" cone_base "" "X" 100.) (setq cone_1 (entlast)) (reset_sysvar) ) ;;; ;;; ;;;------------------------draw components in two viewports----------------------------- ;;;Torus_2views ;;; (defun c:torus_2views( ) (setup_archytas_base) ;;Create a torus with zero inner radius (alert "\nCreate a quadrant of torus with zero inner radius \nby rotating a semi circle around Z-axis") (setvar "CECOLOR" "4") (command "_.pline" pnt_a pnt_c "_A" "_CE" pnt_o pnt_a "") (setq semi_circle_2 (entlast)) ;;rotate the semi circle 90 degrees, making it vertical to plane ABC (command "_.rotate3d" semi_circle_2 "" "2" pnt_a pnt_c 90.) (setq torus_base (entlast)) ;;revolve this semi-circle 90 degrees around z-axiz into surface (command "_.revolve" torus_base "" "_O" zaxis_line 90.) (setq torus_1 (entlast)) ;;;define selection set cylinder_zero (setq torus_zero (ssget "X")) (alert "\nSplit viewports into two.") ;;;open 2 viewports (command "_.vports" "2" "v") (alert "\nZoom using Object option") (setvar "CVPORT" 2) (command "_.zoom" "O" torus_zero "") (setvar "CVPORT" 3) (command "_.zoom" "O" torus_zero "") (command "_.shademode" "G") (reset_sysvar) ) ;;; ;;; ;;;cylinder_2views ;;; (defun c:cylinder_2views( ) (setup_archytas_base) (command "_.delay" 1000) ;;create a cylinder with color yellow(2) (alert "\nCreate a semi circle with diameter AC \nand create extrusion in Z-direction") (setvar "CECOLOR" "2") (command "_.pline" pnt_az pnt_cz "_A" "_CE" pnt_oz pnt_az "") (setq semi_circle_1 (entlast)) (command "_.extrude" semi_circle_1 "" cylinder_height extrusion_angle) (setq cylinder_1 (entlast)) ;;;define selection set cylinder_zero (setq cylinder_zero (ssget "X")) (alert "\nSplit viewports into two.") ;;;open 2 viewports (command "_.vports" "2" "v") (alert "\nZoom using Object option") (setvar "CVPORT" 2) (command "_.zoom" "O" cylinder_zero "") (setvar "CVPORT" 3) (command "_.zoom" "O" cylinder_zero "") (command "_.shademode" "G") (reset_sysvar) ) ;;; ;;; ;;;cone_2views ;;; (defun c:cone_2views( ) (setup_archytas_base) ;;;Create a right cone first on X-Y plane and rotate it 90 degrees ;;;about the line connecting points C & D so that the center line ;;;will coincide with X-axis (line AC) (alert "\nCreate a cylinder whose generator line is AD") (setvar "CECOLOR" "6") ;;:magenta color (command "_.pline" pnt_a pnt_d pnt_c "cl") (setq cone_base (entlast)) (command "_.revolve" cone_base "" "X" 100.) (setq cone_1 (entlast)) ;;;define selection set cone_zero (setq cone_zero (ssget "X")) (alert "\nSplit viewports into two.") ;;;open 2 viewports (command "_.vports" "2" "v") (alert "\nZoom using Object option") (setvar "CVPORT" 2) (command "_.zoom" "O" cone_zero "") (setvar "CVPORT" 3) (command "_.zoom" "O" cone_zero "") (command "_.shademode" "G") (reset_sysvar) ) ;;; ;;;shade the vport #3 by Gouraud shading ;;; ;;; (defun vp_shade(vp_target / old_cv) (setq old_cv (getvar "CVPORT")) (setvar "CVPORT" vp_target) (command "_.shademode" "G") (setvar "CVPORT" old_cv) ) ;;;; ;;;;