[vtkusers] updating plane placement in vtkImagePlaneWidget

Greg Book gbook at gbook.org
Mon Aug 10 10:58:16 EDT 2009


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?




More information about the vtkusers mailing list