[vtkusers] update view with animation effect

pablo p del castillo pablodecastillo at yahoo.es
Wed Feb 10 14:21:51 EST 2010


Hello,

I programmed this procedure to solve it. 

proc UpdateViewFly {x y z vx vy vz} {
    global renWin
    set camera [ren1 GetActiveCamera]
    set position2 [$camera GetPosition ]
    puts $position2
   set xi [lindex $position2 0]
   set yi [lindex $position2 1]
   set zi [lindex $position2 2]
   set dx [ expr ($x - $xi)/200 ]
   set dy [ expr ($y - $yi)/200 ]
   set dz [ expr ($z - $zi)/200 ]

    set position2 [$camera GetViewUp ]
    puts $position2
   set vxi [lindex $position2 0]
   set vyi [lindex $position2 1]
   set vzi [lindex $position2 2]
   set dvx [ expr ($vx - $vxi)/200 ]
   set dvy [ expr ($vy - $vyi)/200 ]
   set dvz [ expr ($vz - $vzi)/200 ]
for {set i 0} {$i < 201} {incr i} {
   after 20
   # render the image
   $renWin Render
   set xf [ expr ($xi + $dx*$i) ]
   set yf [ expr ($yi + $dy*$i) ]
   set zf [ expr ($zi + $dz*$i) ]
   $camera SetPosition $xf $yf $zf
   set xvf [ expr ($vxi + $dvx*$i) ]
   set yvf [ expr ($vyi + $dvy*$i) ]
   set zvf [ expr ($vzi + $dvz*$i) ]
   $camera SetViewUp $xvf $yvf $zvf
   ren1 ResetCamera
}

}



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100210/f884419a/attachment.htm>


More information about the vtkusers mailing list