### CubeHamSweep.slf ### Sweep along 8 cube edges ### CHS 2004/10/15 ### The polyline sweep in SLIDE is not properly done ==> FIX IT ! ### there is a small twist occurring - when not needed ! ### use this only for conceptual stuff ... tclinit { set winName .slfWINDOW source SLIDEUI.tcl source MATH.tcl proc CreateSliders { parent name } { set subname "slf_[subst $name]" if { $parent == {} } { set root .$subname } elseif { $parent == "." } { set root .$subname } else { set root $parent.$subname } toplevel $root set profile [CreateScale $name $root profile "profile" 3.0 0.1 4.0 0.1 1 horizontal] set azim [CreateScale $name $root azim "azimuth" 0 -270 270 1 1 horizontal] set twist [CreateScale $name $root twist "overall twist" 0 -180 180 0.1 1 horizontal] pack $profile $azim $twist -side top -fill x } CreateSliders $winName slider } #################### # Profile #################### #### asymmetrical profile to better track the mapping of edges around the joints point B ( 0 {expr -$slider_profile*0.2 } 0 ) endpoint point X ( {expr $slider_profile*0.1} 0 0 ) endpoint point Y ( 0 {expr $slider_profile*0.1} 0) endpoint point A ( {expr -$slider_profile*0.1} 0 0) endpoint polyline crossx pointlist ( B X Y A B ) endpolyline crosssection profile type polyline crossx endcrosssection crosssection hex type circle radius {expr $slider_profile*0.1} slices 6 endcrosssection #################### # Path #################### point v1 ( 1 1 -1 ) endpoint point v2 ( 1 1 1 ) endpoint point v3 ( -1 1 1 ) endpoint point v4 ( -1 1 -1 ) endpoint point v5 ( -1 -1 -1 ) endpoint point v6 ( -1 -1 1 ) endpoint point v7 ( 1 -1 1 ) endpoint point v8 ( 1 -1 -1 ) endpoint polyline hampath pointlist ( v1 v2 v3 v4 v5 v6 v7 v8 v1 ) endpolyline sweep beam path hampath minimizetorsion 1 closed 0 azimuth {expr $slider_azim} twist {expr $slider_twist} endpath crosssection profile #crosssection hex endcrosssection #solid SLF_HOLLOW endsweep ########################################################### group assembly instance beam surface Y endinstance endgroup #################### VIEWING ############################### surface Y color (1.0 1.0 0.1) endsurface group World instance assembly scale (0.15 0.15 0.15) #shading SLF_WIRE endinstance endgroup #### CAMERA camera cam projection SLF_PARALLEL #projection SLF_PERSPECTIVE frustum (-0.2 -0.2 -2) (0.2 0.2 -0.2) endcamera group gCamera instance cam id instCam translate (0.0 0.0 1.0) endinstance endgroup #### LIGHT light lite type SLF_DIRECTIONAL endlight group gLight0 instance lite id instLite0 lookat eye (1.0 1.0 1.0) target (0.0 0.0 0.0) up (0.0 1.0 0.0) endlookat endinstance endgroup group gLight1 instance lite id instLite1 lookat eye (-1.0 -1.0 0.0) target (0.0 0.0 0.0) up (0.0 1.0 0.0) endlookat endinstance endgroup light lite2 type SLF_AMBIENT color (0.3 0.3 0.3) endlight group gLight2 instance lite2 id instLite2 endinstance endgroup #### RENDER window WINDOW background (0.1 0.2 0.4) endwindow viewport VIEWPORT WINDOW origin (0.0 0.0) size (1.0 1.0) endviewport render VIEWPORT gCamera.instCam.cam World light gLight0.instLite0.lite light gLight1.instLite1.lite light gLight2.instLite2.lite2 endrender ######################################################################