[vtkusers] Moving a 2D plane along its normal vector?

chasank chasank at gmail.com
Mon Jan 27 06:15:32 EST 2014


Hi all,

*First Question : I want to move an oblique slice (plane) along its normal
with vtkPlane. It's ok to use vtkPlane::Push(double distance) when the
normal vector is unit vector ( for orthogonal planes ) to move plane by
spacing. For example if the normal vector is z [0, 0, 1] distance value will
be spacing[2]. What about for oblique planes, How should I calculate the
spacing (distance) value?*

*Second Question: I'm dealing same problem with vtkImagePlaneWidget. I can
rotate a plane around arbitrary chosen (axis-normal) with the following code
block; *

void ImagePlaneCallback::RotatePlaneOnAxis(double angle, double *axis,
vtkImagePlaneWidget *widget)
{
    double pt1[3], pt2[3], widgetCenter[3], widgetOrigin[3];

    widget->GetPoint1(pt1);
    widget->GetPoint2(pt2);
    widget->GetOrigin(widgetOrigin);
    widget->GetCenter(widgetCenter);

    vtkTransform *transform = vtkTransform::New();
    transform->Identity();
    transform->Translate(widgetCenter[0], widgetCenter[1], widgetCenter[2]);
    transform->RotateWXYZ(angle, axis);
    transform->Translate(-widgetCenter[0], -widgetCenter[1],
-widgetCenter[2]);

    double newPt[3];
    transform->TransformPoint(pt1, newPt);
    widget->SetPoint1(newPt);
    transform->TransformPoint(pt2, newPt);
    widget->SetPoint2(newPt);
    transform->TransformPoint(widgetOrigin, newPt);
    widget->SetOrigin(newPt);
    widget->UpdatePlacement();

    transform->Delete();
}

What about to move the plane along its normal vector. Is it possible using
vtkTransform? And it's important again here, what should be the spacing
values will be for oblique planes?
Thanks all.



--
View this message in context: http://vtk.1045678.n5.nabble.com/Moving-a-2D-plane-along-its-normal-vector-tp5725638.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list