[vtkusers] vtkPlaneSource from a vtkPlaneWidget
Luis Vieira
luis.vieira at vektore.com
Tue Jul 26 10:52:25 EDT 2016
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160726/f517f7a9/attachment.html>
More information about the vtkusers
mailing list