[vtkusers] updating plane placement in vtkImagePlaneWidget

Dean Inglis dean.inglis at sympatico.ca
Mon Aug 10 16:14:10 EDT 2009


Hi Greg,
 
sometimes this happens if you use a GUI element 
that embeds a vtkRenderWindow and that element does
not have focus.  As soon as you place the mouse in
the renderwindow and click, the renderer updates.
try: 
planeWidgetX->GetInteractor()->Render();
 
Dean
 
www.camris.ca
 
I'm using a vtkImagePlaneWidget to display some 3d data, and I need to
programmaticaly change the location of the current plane. I'm trying to
increment or decrement the location along the current plane normal. It
appears to work... but not completely. When I change points1,2,and the
origin, it updates the position of the bounding box of the plane, but
not the plane itself. If I try to move the plane with the middle mouse
button, it suddenly jumps to where it should be and then moves normally.
 
Here is the code to change the location of the plane along the current
normal:
 
    double *normal;
    double *origin;
    double *p1;
    double *p2;
 
    normal = planeWidgetX->GetNormal();
 
    origin = planeWidgetX->GetOrigin();
    origin[0]-=normal[0]; origin[1]-=normal[1]; origin[2]-=normal[2];
    planeWidgetX->SetOrigin(origin);
 
    p1 = planeWidgetX->GetPoint1();
    p1[0]-=normal[0]; p1[1]-=normal[1]; p1[2]-=normal[2];
    planeWidgetX->SetPoint1(p1);
 
    p2 = planeWidgetX->GetPoint2();
    p2[0]-=normal[0]; p2[1]-=normal[1]; p2[2]-=normal[2];
    planeWidgetX->SetPoint2(p2);
 
    planeWidgetX->Modified();
    planeWidgetX->UpdatePlacement();
    //planeWidgetX->GetTexturePlaneProperty()->Render();
    vtkWindow->Render();
 
How do I update the plane once I've changed it's position?

 

 

 

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


More information about the vtkusers mailing list