[vtkusers] moving a plane in the screen

Mauricio Reyes maurey at ctcinternet.cl
Wed Oct 18 12:00:22 EDT 2000


Hi my name is Mauricio, I want to interactively move a plane when I hold
the mouse button pressed and when I release the button save the X
position y en window.  this is a part of the script...

....
...
....
vtkCellPicker piker
  piker SetTolerance 0.01

vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin
    iren SetPicker piker

vtkPlaneSource plano
plano SetOrigin 0 0 0
plano SetPoint1 0 196 0
plano SetPoint2 0 0 148

vtkPolyDataMapper planoMapper
planoMapper SetInput [plano GetOutput]

vtkActor planoActor
planoActor SetMapper planoMapper
eval [planoActor GetProperty] SetColor  1 0 0
eval [planoActor GetProperty] SetOpacity 0.5
...
...
...
iren SetEndPickMethod PickCelda
iren SetUserMethod {wm deiconify .vtkInteract}

renWin Render

proc {PickCelda} {} {
set posicion [piker GetPickPosition]
set x [lindex $posicion 0]
set xx [expr round($x)]
set centro [plano GetCenter]
plano SetCenter $xx [lindex $centro 1] [lindex $centro 2]
renWin Render
}

the result is good.... but :), it just change the position of the plane
when a press the "p" key after picking in the screen. I want to do that
"on-line" to see the plane moving while I move the mouse with the button
pressed or update the position of the plane when I release the mouse
button.

Thanks in advance , Mauricio :)





More information about the vtkusers mailing list