# VennDiagGen.slf # demo for interactive adjustment # CHS 2006/1/24 ############################################### ### The Tcl Part ############################## tclinit { set winName .slfWindow ## copy those two friles from the .../code directory to your own working directory ## source SLIDEUI.tcl source MATH.tcl proc CreateVarUI { 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 r [CreateScale $name $root r "rotate" 60.0 -90 90 0.1 1 horizontal] set t [CreateScale $name $root t "x-late" 0.80 -1 1 0.01 1 horizontal] pack $r $t -side top -fill x } CreateVarUI $winName var } ### The SLIDE Part ############################## surface R color ( 1 0 0 ) endsurface surface Y color ( 1 1 0 ) endsurface surface G color ( 0 1 0 ) endsurface surface B color ( 0 0 1 ) endsurface surface M color ( 1 0 1 ) endsurface ### an equilateral triangle point K ( -0.381966 0.661584 0 ) endpoint point L ( -0.381966 -0.661584 0 ) endpoint point X ( 0.763932 0 0 ) endpoint ### A simple triangle frame face T (X K L) endface object triangle ( T ) shading SLF_WIRE endobject ### Put triangle at variable distance form origin group tri instance triangle rotate (0 0 1 )({expr $var_r }) translate ( {expr $var_t } 0 0 ) endinstance endgroup ### A 3-fold "Symmetry Generator" ### group assembly instance tri surface R endinstance instance tri surface G rotate (0 0 1) (120) endinstance instance tri surface B rotate (0 0 1) (240) endinstance endgroup # A generic setup for viewing SLF objects ########################################## light amb type SLF_AMBIENT color (0.2 0.2 0.2) endlight light sun type SLF_DIRECTIONAL color (0.8 0.8 0.8) endlight light anti_sun type SLF_DIRECTIONAL color (0.4 0.4 0.4) endlight group world instance assembly scale ( 0.1 0.1 0.1 ) endinstance instance amb id main_amb endinstance instance sun id front_sun rotate (0 1 0) (-30) rotate (0 0 1) (-45) endinstance instance anti_sun id back_sun rotate (1 0 0) (180) rotate (0 1 0) (-30) rotate (0 0 1) (-45) endinstance endgroup camera cam #projection SLF_PARALLEL projection SLF_PERSPECTIVE #frustum ( -0.1 -0.1 -2.0 ) ( 0.1 0.1 -0.01) frustum ( -0.2 -0.2 -2.0 ) ( 0.2 0.2 -0.01) endcamera group gCam instance cam id iCam translate ( 0.0 0.0 1 ) endinstance endgroup window Window background (0.7 0.8 0.9) endwindow viewport vp Window endviewport render vp gCam.iCam.cam world light world.front_sun.sun light world.back_sun.anti_sun light world.main_amb.amb endrender #####################################