[vtkusers] About Transform and Rotation

anast.jm at pg.com anast.jm at pg.com
Mon Oct 28 10:35:06 EST 2002


Bao, Can you be more specific about the problems you are having. The code seems
to run fine for me....john


                                                                
 Internet Mail Message                                          
 Received from host:      public.kitware.com                    
 [24.97.130.19]                                                 
                                                                


From: cogito <baocogito at yahoo.com.cn>@public.kitware.com on 10/26/2002 09:14 PM
ZE8
                                                                                                  
             cogito <baocogito at yahoo.com.cn>           To:   vtkusers at public.kitware.com          
                         @public.kitware.com           Cc:    (bcc: John Anast-JM/PGI)            
                                               Subject:      [vtkusers] About Transform and       
                                                    Rotation                                      
 Sent by:  vtkusers-admin at public.kitware.com                                                      
                         10/26/2002 09:14 AM                                                      
                                                                                                  
                                                                                                  






hi,

   It cannot work well when I run the follow code.

   please help me.

----------------------------------

package require vtk
package require vtkinteraction

# this is a tcl version of plate vibration

vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# read a vtk file
#
vtkPolyDataReader plate
    plate SetFileName "$VTK_DATA_ROOT/Data/plate.vtk"
    plate SetVectorsName "mode8"
vtkWarpVector warp
    warp SetInput [plate GetOutput]
    warp SetScaleFactor 0.5
vtkPolyDataNormals normals
    normals SetInput [warp GetPolyDataOutput]
vtkVectorDot color
    color SetInput [normals GetOutput]
vtkLookupTable lut
    lut SetNumberOfColors 256
    lut Build
    for {set i 0} {$i<128} {incr i 1} {
        eval lut SetTableValue $i [expr (128.0-$i)/128.0] [expr
(128.0-$i)/128.0] [expr (128.0-$i)/128.0] 1
    }
    for {set i 128} {$i<256} {incr i 1} {
        eval lut SetTableValue $i [expr ($i-128.0)/128.0] [expr
($i-128.0)/128.0] [ex pr ($i-128.0)/128.0] 1
    }

vtkDataSetMapper plateMapper
    plateMapper SetInput [color GetOutput]
    plateMapper SetLookupTable lut
    plateMapper SetScalarRange -1 1
vtkActor plateActor
    plateActor SetMapper plateMapper

#-----rotate by Z axis-----------------
#
vtkDataSetMapper m21
m21 SetInput [plate GetOutput]

vtkActor a21
a21 SetMapper m21
a21 RotateZ 90
[a21 GetProperty] SetColor 1 0 0
#
#----------------------

# Add the actors to the renderer, set the background and size
#
ren1 AddActor plateActor
ren1 SetBackground 1 1 1
renWin SetSize 250 250

[ren1 GetActiveCamera] SetPosition 13.3991 14.0764 9.97787
[ren1 GetActiveCamera] SetFocalPoint 1.50437 0.481517 4.52992
[ren1 GetActiveCamera] SetViewAngle 30
[ren1 GetActiveCamera] SetViewUp -0.120861 0.458556 -0.880408
[ren1 GetActiveCamera] SetClippingRange 12.5724 26.8374

# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize

# prevent the tk window from showing up then start the event loop
wm withdraw .



Do You Yahoo!?
"是IT精英吗?小试牛刀获时尚大奖!"



More information about the vtkusers mailing list