Can I make a mirror?

Volpe, Christopher R (CRD) volpecr at crd.ge.com
Mon Dec 6 04:15:12 EST 1999


Couldn't he "fake" the mirror in some way by means of another renderer with an appropriately-defined
camera model rendering into a viewport on the render window where the mirror is supposed to be?
(Perhaps throwing a transform filter in there as well to reflect an axis if the camera isn't flexible
enough to do that?)

-Chris

|> -----Original Message-----
|> From: Lisa Sobierajski Avila [mailto:lisa.avila at kitware.com]
|> Sent: Friday, December 03, 1999 10:43 PM
|> To: Tom G. Smith; vtkusers at gsao.med.ge.com
|> Subject: Re: Can I make a mirror?
|> 
|> 
|> Tom,
|> 
|> The lighting calculations in VTK are performed by OpenGL using local 
|> illumination only. The specular highlight is simply a 
|> reflection of the 
|> light source - not a reflection of the scene. You can use 
|> the RIB exporter 
|> to bring your scene into renderman if you want global illumination.
|> 
|> Lisa
|> 
|> At 02:33 PM 12/3/99 -0600, Tom G. Smith wrote:
|> >You'll see in the attached Tcl script, I'm displaying a 
|> Moebius Strip,
|> >and I'm trying to implement a refective mirror underneath it that
|> >remains oriented to the camera, and shows the reflection of the
|> >underside of the Moebius Strip as the camera rotates around it.
|> >But regardless of what I do with the Specular, Ambient, and Diffuse
|> >parameters, nothing shows up in the mirror.
|> >
|> >A second problem I'm having is, the mirror seems to wobble as I
|> >move the camera.  I suspect this is because I'm using the wrong
|> >coordinate system to orient the mirror, but if anybody has 
|> a suggestion,
|> >it'd be appreciated.
|> >
|> >sym.tcl:
|> >............................................................
|> ................
|> >set Pi [expr acos(-1)] ;# Approx. 3.14159265359
|> >set Degrees [expr 180/$Pi] ;# Conversion factor, degrees to radians.
|> >
|> >source startup.tcl ;# Initialize vtk.
|> >source colors.tcl ;# Define colors
|> >
|> ># Create triangle strip for Moebius. 
|> --------------------------------
|> >set stripwidth 1
|> >set stripradius [expr 1*$stripwidth]
|> >         # Radius of circle about which center is rotated.
|> >set zc [expr $stripwidth/2.0];# z-coordinate of center of strip
|> >set pointcount [expr 1 << 9] ;# Evaluates to 512. Same as 
|> 2**9 in perl.
|> >set xscale 1;# scale factor to elongate graphic
|> >set yscale 2;# scale factor to elongate graphic
|> >set zscale 1;# scale factor to elongate strip size.
|> >vtkPoints points
|> >vtkCellArray strip
|> >strip InsertNextCell [expr $pointcount+2];#number of points
|> >set n 0
|> >while {$n <= $pointcount+1} {
|> >         if [expr !($n % 2)] {
|> >                 set angle [expr 2*$Pi*$n/$pointcount]
|> >                         # angle around center of mobius.
|> >                 set rotate [expr $angle/2]
|> >                         # angle of strip rotation.
|> >                 set xc [expr cos($angle)*$stripradius]
|> >                         # x-coordinate of center of strip.
|> >                 set yc [expr sin($angle)*$stripradius]
|> >                         # y-coordinate of center of strip.
|> >                 set ac [expr $angle+$Pi]
|> >                 if {$ac > 2*$Pi} {
|> >                         set ac [expr $ac - 2*$Pi]
|> >                 }
|> >                         # angle with respect to center of strip of
|> >                         # line across strip, intersecting 
|> with mobius center,
|> >                         # projected on x-y plane.
|> >                 set r [expr abs(sin($rotate)*$zc)]
|> >                         # length of strip projected onto x-y plane.
|> >                 set sign 1
|> >         } else {
|> >                 set sign -1
|> >         }
|> >         set x [expr ($xc+$sign*cos($ac)*$r)*$xscale]
|> >         set y [expr ($yc+$sign*sin($ac)*$r)*$yscale]
|> >         set z [expr ($zc+$sign*cos($rotate)*$zc)*$zscale]
|> >         points InsertPoint $n $x $y $z
|> >         strip InsertCellPoint $n
|> >         incr n
|> >}
|> >vtkPolyData profile
|> >     profile SetPoints points
|> >     profile SetStrips strip
|> >vtkPolyDataMapper map
|> >     map SetInput profile
|> >vtkActor mobius
|> >     mobius SetMapper map
|> >     eval {[mobius GetProperty] SetColor } $colors(steel_blue)
|> >     [mobius GetProperty] BackfaceCullingOff
|> >ren1 AddActor mobius
|> >ren1 SetBackground 1 1 1 ;# Sets background to white.
|> >
|> ># Add text. --------------------------------------------------
|> >vtkTextMapper textMapper
|> >     textMapper SetInput "Modeling Symposium 2000"
|> >     textMapper SetFontSize 18
|> >     textMapper SetFontFamilyToArial
|> >     textMapper BoldOn
|> >     textMapper ItalicOn
|> >     textMapper ShadowOn
|> >vtkActor2D textActor
|> >     textActor SetMapper textMapper
|> >     textActor SetPosition 45 150
|> >     eval {[textActor GetProperty] SetColor } $colors(chocolate)
|> >ren1 AddActor2D textActor
|> >
|> ># Define the mirror. 
|> --------------------------------------------------
|> >vtkPoints planepoints
|> >vtkCellArray planepoly
|> >planepoly InsertNextCell 4; # First thing in a new cell is 
|> the point count.
|> >set v {{-1 -1 1} {1 -1 1} {1 1 -1} {-1 1 -1}}
|> >set f 2.5
|> >set i 0
|> >while {$i < 4} {
|> >         set t [lindex $v $i]
|> >         set x [expr [lindex $t 0]*$f]
|> >         set y [expr ([lindex $t 1]-1.5)*$f]
|> >         set z [expr [lindex $t 2]*$f]
|> >         planepoints InsertPoint $i $x $y $z
|> >         planepoly InsertCellPoint $i; # Add point id.
|> >         incr i
|> >}
|> >vtkPolyData plane
|> >plane SetPoints planepoints; planepoints Delete
|> >plane SetPolys planepoly; planepoly Delete
|> >vtkPolyDataMapper planeMapper
|> >         planeMapper SetInput plane
|> >vtkFollower planeActor
|> >         planeActor SetMapper planeMapper
|> >         planeActor SetCamera [ren1 GetActiveCamera]
|> >         eval {[planeActor GetProperty] SetColor} $colors(grey)
|> >         [planeActor GetProperty] SetOpacity 1
|> >         [planeActor GetProperty] SetSpecularPower 200
|> >         [planeActor GetProperty] SetSpecular .5
|> >         [planeActor GetProperty] SetAmbient .5
|> >         [planeActor GetProperty] SetDiffuse .5
|> >ren1 AddActor planeActor ;# assign our actor to the renderer
|> >
|> >source go.tcl ;# Start the Interactor and display the image.
|> >
|> >startup.tcl:
|> >............................................................
|> ................
|> >#!/usr/bin/tcl
|> >#-----------------------------------------------------------
|> ------------
|> ># Description:  This Tcl script can be sourced to get the typical
|> ># vtk initialization.
|> >#-----------------------------------------------------------
|> ------------
|> ># Changelog:
|> ># 991007 Smitty created.
|> >#-----------------------------------------------------------
|> ------------
|> >catch {load vtktcl} ;# Load the shared vtk libraries.
|> >source /opt/vtk/examplesTcl/vtkInt.tcl ;# Get the interactor ui.
|> >vtkRenderer ren1
|> >         # vtkRenderer provides an abstract specification 
|> for renderers. A
|> >         # renderer is an object that controls the 
|> rendering process for
|> >         # objects. Rendering is the process of converting geometry,
|> >         # a specification for lights, and a camera view into an
|> >         # image. vtkRenderer also performs coordinate 
|> transformation
|> >         # between world coordinates, view coordinates (the computer
|> >         # graphics rendering coordinate system), and 
|> display coordinates
|> >         # (the actual screen coordinates on the display device).
|> >vtkRenderWindow renWin
|> >         # vtkRenderWindow is an abstract object to specify 
|> the behavior
|> >         # of a rendering window. A rendering window is a window
|> >         # in a graphical user interface where renderers draw their
|> >         # images. Methods are provided to synchronize the rendering
|> >         # process, set window size, and control double buffering.
|> >   renWin AddRenderer ren1
|> >         # Associate renderer ren1 with renWin.
|> >vtkRenderWindowInteractor iren
|> >         # vtkRenderWindowInteractor is a convenience 
|> object that provides
|> >         # event bindings to common graphics functions.  
|> Here's a brief
|> >         # summary.  See 
|> http://www.kitware.com/vtkhtml/vtkdata/manhtml/
|> >         # vtkRenderWindowInteractor.html for more detail:
|> >         # Mouse bindings:
|> >         #       camera: Button 1 - rotate
|> >         #               Button 2 - pan
|> >         #               Button 3 - zoom
|> >         #               ctrl-Button 1 - spin
|> >         #       actor:  Button 1 - rotate
|> >         #               Button 2 - pan
|> >         #               Button 3 - uniform scale
|> >         #               ctrl-Button 1 - spin
|> >         #               ctrl-Button 2 - dolly.
|> >         # Keyboard bindings (upper or lower case):
|> >         # j - joystick like mouse interactions
|> >         # t - trackball like mouse interactions
|> >         # o - object/actor interaction
|> >         # c - camera interaction
|> >         # r - reset camera view
|> >         # w - turn all actors wireframe
|> >         # s - turn all actors surface
|> >         # u - execute user defined function
|> >         # p - pick actor under mouse pointer (if pickable)
|> >         # 3 - toggle in/out of 3D mode (if supported by renderer)
|> >         # e - exit
|> >         # q - exit
|> >   iren SetRenderWindow renWin
|> >         # Associate renderwindow renWin with interactor iren.
|> >
|> >
|> >colors.tcl:
|> >............................................................
|> ................
|> >#-----------------------------------------------------------
|> ------------
|> ># Description:  This Tcl script can be sourced to build an array of
|> ># RGB color values.  It's a copy of /opt/vtk/examplesTcl/colors.tcl,
|> ># with a lot of changes.
|> >#-----------------------------------------------------------
|> ------------
|> ># Changelog:
|> ># 991020 Smitty created.
|> >#-----------------------------------------------------------
|> ------------
|> >
|> >#  Whites
|> >set colors(antique_white)  "0.9804 0.9216 0.8431"
|> >set colors(azure)  "0.9412 1.0000 1.0000"
|> >set colors(bisque)  "1.0000 0.8941 0.7686"
|> >set colors(blanched_almond)  "1.0000 0.9216 0.8039"
|> >set colors(cornsilk)  "1.0000 0.9725 0.8627"
|> >set colors(eggshell)  "0.9900 0.9000 0.7900"
|> >set colors(floral_white)  "1.0000 0.9804 0.9412"
|> >set colors(gainsboro)  "0.8627 0.8627 0.8627"
|> >set colors(ghost_white)  "0.9725 0.9725 1.0000"
|> >set colors(honeydew)  "0.9412 1.0000 0.9412"
|> >set colors(ivory)  "1.0000 1.0000 0.9412"
|> >set colors(lavender)  "0.9020 0.9020 0.9804"
|> >set colors(lavender_blush)  "1.0000 0.9412 0.9608"
|> >set colors(lemon_chiffon)  "1.0000 0.9804 0.8039"
|> >set colors(linen)  "0.9804 0.9412 0.9020"
|> >set colors(mint_cream)  "0.9608 1.0000 0.9804"
|> >set colors(misty_rose)  "1.0000 0.8941 0.8824"
|> >set colors(moccasin)  "1.0000 0.8941 0.7098"
|> >set colors(navajo_white)  "1.0000 0.8706 0.6784"
|> >set colors(old_lace)  "0.9922 0.9608 0.9020"
|> >set colors(papaya_whip)  "1.0000 0.9373 0.8353"
|> >set colors(peach_puff)  "1.0000 0.8549 0.7255"
|> >set colors(seashell)  "1.0000 0.9608 0.9333"
|> >set colors(snow)  "1.0000 0.9804 0.9804"
|> >set colors(thistle)  "0.8471 0.7490 0.8471"
|> >set colors(titanium_white)  "0.9900 1.0000 0.9400"
|> >set colors(wheat)  "0.9608 0.8706 0.7020"
|> >set colors(white)  "1.0000 1.0000 1.0000"
|> >set colors(white_smoke)  "0.9608 0.9608 0.9608"
|> >set colors(zinc_white)  "0.9900 0.9700 1.0000"
|> >
|> >#  Greys
|> >set colors(cold_grey)  "0.5000 0.5400 0.5300"
|> >set colors(dim_grey)  "0.4118 0.4118 0.4118"
|> >set colors(grey)  "0.7529 0.7529 0.7529"
|> >set colors(light_grey)  "0.8275 0.8275 0.8275"
|> >set colors(slate_grey)  "0.4392 0.5020 0.5647"
|> >set colors(slate_grey_dark)  "0.1843 0.3098 0.3098"
|> >set colors(slate_grey_light)  "0.4667 0.5333 0.6000"
|> >set colors(warm_grey)  "0.5000 0.5000 0.4100"
|> >
|> >#  Blacks
|> >set colors(black)  "0.0000 0.0000 0.0000"
|> >set colors(ivory_black)  "0.1600 0.1400 0.1300"
|> >set colors(lamp_black)  "0.1800 0.2800 0.2300"
|> >
|> >#  Reds
|> >set colors(alizarin_crimson)  "0.8900 0.1500 0.2100"
|> >set colors(brick)  "0.6100 0.4000 0.1200"
|> >set colors(cadmium_red_deep)  "0.8900 0.0900 0.0500"
|> >set colors(coral)  "1.0000 0.4980 0.3137"
|> >set colors(coral_light)  "0.9412 0.5020 0.5020"
|> >set colors(deep_pink)  "1.0000 0.0784 0.5765"
|> >set colors(english_red)  "0.8300 0.2400 0.1000"
|> >set colors(firebrick)  "0.6980 0.1333 0.1333"
|> >set colors(geranium_lake)  "0.8900 0.0700 0.1900"
|> >set colors(hot_pink)  "1.0000 0.4118 0.7059"
|> >set colors(indian_red)  "0.6900 0.0900 0.1200"
|> >set colors(light_salmon)  "1.0000 0.6275 0.4784"
|> >set colors(madder_lake_deep)  "0.8900 0.1800 0.1900"
|> >set colors(maroon)  "0.6902 0.1882 0.3765"
|> >set colors(pink)  "1.0000 0.7529 0.7961"
|> >set colors(pink_light)  "1.0000 0.7137 0.7569"
|> >set colors(raspberry)  "0.5300 0.1500 0.3400"
|> >set colors(red)  "1.0000 0.0000 0.0000"
|> >set colors(rose_madder)  "0.8900 0.2100 0.2200"
|> >set colors(salmon)  "0.9804 0.5020 0.4471"
|> >set colors(tomato)  "1.0000 0.3882 0.2784"
|> >set colors(venetian_red)  "0.8300 0.1000 0.1200"
|> >
|> >#  Browns
|> >set colors(beige)  "0.6400 0.5800 0.5000"
|> >set colors(brown)  "0.5000 0.1647 0.1647"
|> >set colors(brown_madder)  "0.8600 0.1600 0.1600"
|> >set colors(brown_ochre)  "0.5300 0.2600 0.1200"
|> >set colors(burlywood)  "0.8706 0.7216 0.5294"
|> >set colors(burnt_sienna)  "0.5400 0.2100 0.0600"
|> >set colors(burnt_umber)  "0.5400 0.2000 0.1400"
|> >set colors(chocolate)  "0.8235 0.4118 0.1176"
|> >set colors(deep_ochre)  "0.4500 0.2400 0.1000"
|> >set colors(flesh)  "1.0000 0.4900 0.2500"
|> >set colors(flesh_ochre)  "1.0000 0.3400 0.1300"
|> >set colors(gold_ochre)  "0.7800 0.4700 0.1500"
|> >set colors(greenish_umber)  "1.0000 0.2400 0.0500"
|> >set colors(khaki)  "0.9412 0.9020 0.5490"
|> >set colors(khaki_dark)  "0.7412 0.7176 0.4196"
|> >set colors(light_beige)  "0.9608 0.9608 0.8627"
|> >set colors(peru)  "0.8039 0.5216 0.2471"
|> >set colors(rosy_brown)  "0.7373 0.5608 0.5608"
|> >set colors(raw_sienna)  "0.7800 0.3800 0.0800"
|> >set colors(raw_umber)  "0.4500 0.2900 0.0700"
|> >set colors(sepia)  "0.3700 0.1500 0.0700"
|> >set colors(sienna)  "0.6275 0.3216 0.1765"
|> >set colors(saddle_brown)  "0.5451 0.2706 0.0745"
|> >set colors(sandy_brown)  "0.9569 0.6431 0.3765"
|> >set colors(tan)  "0.8235 0.7059 0.5490"
|> >set colors(van_dyke_brown)  "0.3700 0.1500 0.0200"
|> >
|> >#  Oranges
|> >set colors(cadmium_orange)  "1.0000 0.3800 0.0100"
|> >set colors(cadmium_red_light)  "1.0000 0.0100 0.0500"
|> >set colors(carrot)  "0.9300 0.5700 0.1300"
|> >set colors(dark_orange)  "1.0000 0.5490 0.0000"
|> >set colors(mars_orange)  "0.5900 0.2700 0.0800"
|> >set colors(mars_yellow)  "0.8900 0.4400 0.1000"
|> >set colors(orange)  "1.0000 0.5000 0.0000"
|> >set colors(orange_red)  "1.0000 0.2706 0.0000"
|> >set colors(yellow_ochre)  "0.8900 0.5100 0.0900"
|> >
|> >#  Yellows
|> >set colors(aureoline_yellow)  "1.0000 0.6600 0.1400"
|> >set colors(banana)  "0.8900 0.8100 0.3400"
|> >set colors(cadmium_lemon)  "1.0000 0.8900 0.0100"
|> >set colors(cadmium_yellow)  "1.0000 0.6000 0.0700"
|> >set colors(cadmium_yellow_light)  "1.0000 0.6900 0.0600"
|> >set colors(gold)  "1.0000 0.8431 0.0000"
|> >set colors(goldenrod)  "0.8549 0.6471 0.1255"
|> >set colors(goldenrod_dark)  "0.7216 0.5255 0.0431"
|> >set colors(goldenrod_light)  "0.9804 0.9804 0.8235"
|> >set colors(goldenrod_pale)  "0.9333 0.9098 0.6667"
|> >set colors(light_goldenrod)  "0.9333 0.8667 0.5098"
|> >set colors(melon)  "0.8900 0.6600 0.4100"
|> >set colors(naples_yellow_deep)  "1.0000 0.6600 0.0700"
|> >set colors(yellow)  "1.0000 1.0000 0.0000"
|> >set colors(yellow_light)  "1.0000 1.0000 0.8784"
|> >
|> >#  Greens
|> >set colors(chartreuse)  "0.4980 1.0000 0.0000"
|> >set colors(chrome_oxide_green)  "0.4000 0.5000 0.0800"
|> >set colors(cinnabar_green)  "0.3800 0.7000 0.1600"
|> >set colors(cobalt_green)  "0.2400 0.5700 0.2500"
|> >set colors(emerald_green)  "0.0000 0.7900 0.3400"
|> >set colors(forest_green)  "0.1333 0.5451 0.1333"
|> >set colors(green)  "0.0000 1.0000 0.0000"
|> >set colors(green_dark)  "0.0000 0.3922 0.0000"
|> >set colors(green_pale)  "0.5961 0.9843 0.5961"
|> >set colors(green_yellow)  "0.6784 1.0000 0.1843"
|> >set colors(lawn_green)  "0.4863 0.9882 0.0000"
|> >set colors(lime_green)  "0.1961 0.8039 0.1961"
|> >set colors(mint)  "0.7400 0.9900 0.7900"
|> >set colors(olive)  "0.2300 0.3700 0.1700"
|> >set colors(olive_drab)  "0.4196 0.5569 0.1373"
|> >set colors(olive_green_dark)  "0.3333 0.4196 0.1843"
|> >set colors(permanent_green)  "0.0400 0.7900 0.1700"
|> >set colors(sap_green)  "0.1900 0.5000 0.0800"
|> >set colors(sea_green)  "0.1804 0.5451 0.3412"
|> >set colors(sea_green_dark)  "0.5608 0.7373 0.5608"
|> >set colors(sea_green_medium)  "0.2353 0.7020 0.4431"
|> >set colors(sea_green_light)  "0.1255 0.6980 0.6667"
|> >set colors(spring_green)  "0.0000 1.0000 0.4980"
|> >set colors(spring_green_medium)  "0.0000 0.9804 0.6039"
|> >set colors(terre_verte)  "0.2200 0.3700 0.0600"
|> >set colors(viridian_light)  "0.4300 1.0000 0.4400"
|> >set colors(yellow_green)  "0.6039 0.8039 0.1961"
|> >
|> >#  Cyans
|> >set colors(aquamarine)  "0.4980 1.0000 0.8314"
|> >set colors(aquamarine_medium)  "0.4000 0.8039 0.6667"
|> >set colors(cyan)  "0.0000 1.0000 1.0000"
|> >set colors(cyan_white)  "0.8784 1.0000 1.0000"
|> >set colors(turquoise)  "0.2510 0.8784 0.8157"
|> >set colors(turquoise_dark)  "0.0000 0.8078 0.8196"
|> >set colors(turquoise_medium)  "0.2824 0.8196 0.8000"
|> >set colors(turquoise_pale)  "0.6863 0.9333 0.9333"
|> >
|> >#  Blues
|> >set colors(alice_blue)  "0.9412 0.9725 1.0000"
|> >set colors(blue)  "0.0000 0.0000 1.0000"
|> >set colors(blue_light)  "0.6784 0.8471 0.9020"
|> >set colors(blue_medium)  "0.0000 0.0000 0.8039"
|> >set colors(cadet)  "0.3725 0.6196 0.6275"
|> >set colors(cobalt)  "0.2400 0.3500 0.6700"
|> >set colors(cornflower)  "0.3922 0.5843 0.9294"
|> >set colors(cerulean)  "0.0200 0.7200 0.8000"
|> >set colors(dodger_blue)  "0.1176 0.5647 1.0000"
|> >set colors(indigo)  "0.0300 0.1800 0.3300"
|> >set colors(manganese_blue)  "0.0100 0.6600 0.6200"
|> >set colors(midnight_blue)  "0.0980 0.0980 0.4392"
|> >set colors(navy)  "0.0000 0.0000 0.5020"
|> >set colors(peacock)  "0.2000 0.6300 0.7900"
|> >set colors(powder_blue)  "0.6902 0.8784 0.9020"
|> >set colors(royal_blue)  "0.2549 0.4118 0.8824"
|> >set colors(slate_blue)  "0.4157 0.3529 0.8039"
|> >set colors(slate_blue_dark)  "0.2824 0.2392 0.5451"
|> >set colors(slate_blue_light)  "0.5176 0.4392 1.0000"
|> >set colors(slate_blue_medium)  "0.4824 0.4078 0.9333"
|> >set colors(sky_blue)  "0.5294 0.8078 0.9216"
|> >set colors(sky_blue_deep)  "0.0000 0.7490 1.0000"
|> >set colors(sky_blue_light)  "0.5294 0.8078 0.9804"
|> >set colors(steel_blue)  "0.2745 0.5098 0.7059"
|> >set colors(steel_blue_light)  "0.6902 0.7686 0.8706"
|> >set colors(turquoise_blue)  "0.0000 0.7800 0.5500"
|> >set colors(ultramarine)  "0.0700 0.0400 0.5600"
|> >
|> >#  Magentas
|> >set colors(blue_violet)  "0.5412 0.1686 0.8863"
|> >set colors(cobalt_violet_deep)  "0.5700 0.1300 0.6200"
|> >set colors(magenta)  "1.0000 0.0000 1.0000"
|> >set colors(orchid)  "0.8549 0.4392 0.8392"
|> >set colors(orchid_dark)  "0.6000 0.1961 0.8000"
|> >set colors(orchid_medium)  "0.7294 0.3333 0.8275"
|> >set colors(permanent_red_violet)  "0.8600 0.1500 0.2700"
|> >set colors(plum)  "0.8667 0.6275 0.8667"
|> >set colors(purple)  "0.6275 0.1255 0.9412"
|> >set colors(purple_medium)  "0.5765 0.4392 0.8588"
|> >set colors(ultramarine_violet)  "0.3600 0.1400 0.4300"
|> >set colors(violet)  "0.5600 0.3700 0.6000"
|> >set colors(violet_dark)  "0.5804 0.0000 0.8275"
|> >set colors(violet_red)  "0.8157 0.1255 0.5647"
|> >set colors(violet_red_medium)  "0.7804 0.0824 0.5216"
|> >set colors(violet_red_pale)  "0.8588 0.4392 0.5765"
|> >
|> >proc showcolors {} {
|> >#------------------------------------------------------------------
|> ># Called to display all the possible color names.
|> >#------------------------------------------------------------------
|> >         global colors
|> >
|> >         foreach key [lsort [array names colors]] {
|> >                 set value $colors($key)
|> >                 puts "$key=$value"
|> >         }
|> >} ;# End showcolors.
|> >
|> >proc tablecolors {tablename colornames {count 0}} {
|> >#------------------------------------------------------------------
|> ># Called to build a vtkLookupTable object based on a list of
|> ># color names.  If count is greater than the number of colors in
|> ># colornames, the table will be built with $count entries and the
|> ># colors in colornames will be cycled to fill out the table.
|> >#------------------------------------------------------------------
|> >         global colors
|> >
|> >         if {$count < 1} { set count [llength $colornames]; }
|> >         upvar $tablename lut
|> >         vtkLookupTable lut
|> >         lut SetNumberOfColors $count
|> >                 # Specify the number of values (i.e., 
|> colors) in the lookup
|> >                 # table. This method simply allocates 
|> memory and prepares the
|> >                 # table for use with SetTableValue(). It 
|> differs from Build()
|> >                 # method in that the allocated memory is 
|> not initialized
|> >                 # according to HSVA ramps.
|> >         lut SetTableRange 0 [expr $count - 1]
|> >                 # Declared as "void SetTableRange(float r[2]);" in
|> >                 # vtkLookupTable.h.  I found source for it in
|> >                 # vtkLookupTable.cxx that looks like this, in part:
|> >                 #   void  
|> vtkLookupTable::SetTableRange(float min, float max)
|> >                 #   { this->TableRange[0] = min; 
|> this->TableRange[1] = max; }
|> >         lut Build
|> >                 # Build is a virtual function inherited from 
|> > vtkScalarsToColors
|> >                 # class, where it's declared as "virtual 
|> void Build() {};".
|> >                 # The actual source for it is in 
|> vtkLookupTable.cxx.
|> >                 # Using pre-established (perhaps default) 
|> values for
|> >                 # HueRange, SaturationRange, ValueRange, 
|> and AlphaRange,
|> >                 # it builds the specified set of colors (see 
|> > SetNumberOfColors
|> >                 # and SetTableRange above).
|> >         set ix 0; # Color table index.
|> >         set jx 0; # Color name index.
|> >         while {$ix < $count} {
|> >                 set name [lindex $colornames $jx]
|> >                 incr jx
|> >                 if {$jx == [llength $colornames]} { set jx 0; }
|> >                 if {![info exists colors($name)]} {
|> >                         puts "ERROR: Color $name is not defined."
|> >                         exit 1
|> >                 }
|> >                 set cmd "lut SetTableValue $ix $colors($name) 1"
|> >                 eval $cmd
|> >                         # SetTableValue expects 5 arguments:
|> >                         # 1.    The index (relative 0) of 
|> the colortable 
|> > entry
|> >                         #       to be set.
|> >                         # 2.    The red component of the RGB value.
|> >                         #       A number from 0 to 1.
|> >                         # 3.    The green component of the 
|> RGB value.
|> >                         #       A number from 0 to 1.
|> >                         # 4.    The blue component of the 
|> RGB value.
|> >                         #       A number from 0 to 1.
|> >                         # 5.    The alpha, or 
|> transparency, component.
|> >                         #       A number from 0 to 1, 1 
|> being totally opaque.
|> >                 incr ix
|> >         }
|> >} ;# End tablecolors.
|> >
|> >go.tcl:
|> >............................................................
|> ................
|> >#!/usr/bin/tcl
|> >#-----------------------------------------------------------
|> ------------
|> ># Description:  This Tcl script can be sourced to get the typical
|> ># vtk code to start the interactor, and to display the final image.
|> >#-----------------------------------------------------------
|> ------------
|> ># Changelog:
|> ># 991013 Smitty created.
|> >#-----------------------------------------------------------
|> ------------
|> >iren SetUserMethod {wm deiconify .vtkInteract}; # Enable 
|> user interactor.
|> >iren Initialize; # render the image
|> >wm withdraw .;  # prevent tk window from showing up, then 
|> start the event 
|> >loop.
|> >
|> >
|> >
|> >------------------------------------------------------------
|> -----------------
|> >This is the private VTK discussion list.  Please keep 
|> messages on-topic.
|> >Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
|> >To UNSUBSCRIBE, send message body containing "unsubscribe 
|> vtkusers" to
|> ><majordomo at gsao.med.ge.com>.  For help, send message body containing
|> >"info vtkusers" to the same address.     Live long and prosper.
|> >------------------------------------------------------------
|> -----------------
|> 
|> 
|> 
|> 
|> -------------------------------------------------------------
|> ----------------
|> This is the private VTK discussion list.  Please keep 
|> messages on-topic.
|> Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
|> To UNSUBSCRIBE, send message body containing "unsubscribe 
|> vtkusers" to
|> <majordomo at gsao.med.ge.com>.  For help, send message body containing
|> "info vtkusers" to the same address.     Live long and prosper.
|> -------------------------------------------------------------
|> ----------------
|> 


-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list