[vtkusers] vtkPlaneSource from a vtkPlaneWidget

Mike Chinander chinander at gmail.com
Tue Jul 26 11:22:36 EDT 2016


For vtkPlaneSource, you have to set the Origin (you have this commented
out), Point1, and Point2. You shouldn't have to set the PlaneSource's
normal unless you want to change it's orientation as defined by the origin
and the two points.

On Tue, Jul 26, 2016 at 9:52 AM, Luis Vieira <luis.vieira at vektore.com>
wrote:

> Hello vtkusers,
>
>
>
> I am trying to draw a vtkPlaneSource from a vtkPlaneWidget after some user
> interactions. I had extracted Point1, Point2, Normal and Center from my
> Widget as well. However, applying against a vtkPlaneSource the result does
> not reflect the vtkPlaneWidget's definitions chosen by the user. It means,
> basically size and orientation of the final plane. Many thanks for any help.
>
>
>
> following my snapshot.
>
>
>
> planeWidget = vtkSmartPointer<vtkPlaneWidget>::New();
>
> planeWidget->SetInteractor(mouseClickCallback->renderWindowInteractor);
>  //iren is vtkRenderWindowInteractor
>
> planeWidget->SetInputConnection(mydataset);
>
> planeWidget->SetPlaceFactor(1.0);
>
> planeWidget->SetHandleSize(0.03);
>
> planeWidget->SetResolution(10);
>
> planeWidget->GetHandleProperty()->SetColor(0, 0.6, 0.1);
>
> planeWidget->GetPlaneProperty()->SetColor(0, 0.3, 1);
>
> planeWidget->GetPlaneProperty()->SetEdgeColor(0, 0.9, 1);
>
> planeWidget->GetPlaneProperty()->SetEdgeVisibility(1);
>
> planeWidget->PlaceWidget();
>
> planeWidget->SetRepresentationToSurface();
>
> planeWidget->GetPolyData(planeW);
>
> planeWidget->AddObserver(vtkCommand::InteractionEvent, mouseClickCallback);
>
> planeWidget->SetNormal(normalVector[0], normalVector[1], normalVector[2]);
> // normal of my target plane
>
> planeWidget->SetCenter(center[0], center[1], center[2]); // origin of my
> target plane
>
> planeWidget->UpdatePlacement();
>
> planeWidget->EnabledOn();
>
>
>
> Callback Interactions
>
>
>
> _plane = vtkPlane::New();
>
> vtkPolyData *polydata = vtkPolyData::New();
>
> vtkSmartPointer<vtkExtractEdges> extractEdges =
>
> vtkSmartPointer<vtkExtractEdges>::New();
>
> planeWidget->GetPlane(_plane);
>
> planeWidget->GetPolyData(polydata);
>
> planeWidget->GetPoint1(Point1);
>
> planeWidget->GetPoint2(Point2);
>
> planeWidget->GetCenter(Center);
>
> extractEdges->SetInputData(0, polydata);
>
> extractEdges->Update();
>
>
>
> vtkSmartPointer<vtkPlane> newPlane = vtkSmartPointer<vtkPlane>::New();
>
> newPlane->SetNormal(planeWidget->GetNormal());
>
> newPlane->SetOrigin(planeWidget->GetOrigin());
>
>
>
> VtkPlaneSource
>
>
>
> vtkSmartPointer<vtkPlaneSource> planeSource =
>
> vtkSmartPointer<vtkPlaneSource>::New();
>
> planeSource->SetPoint1(Point1[0], Point1[1], Point1[2]);//Point1
>
> planeSource->SetPoint2(Point2[0], Point2[1], Point2[2]);//Point2
>
> //planeSource->SetOrigin(newPlane->Origin[0], newPlane->Origin[1],
> newPlane->Origin[2]);//
>
> planeSource->SetCenter(Center[0], Center[1], Center[2]);
>
> planeSource->SetNormal(newPlane->GetNormal()[0], newPlane->GetNormal()[1],
> newPlane->GetNormal()[2]);
>
> planeSource->Update();
>
>
>
>
>
> Anybody here knows whats is wrong with my solution? Once, again many
> thanks for any help.
>
>
>
>
>
> *Luis *
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160726/5b62f5d1/attachment.html>


More information about the vtkusers mailing list