[vtkusers] Add a plan to a vtkPolyData
Frantch
le_maitre at bluewin.ch
Wed Jan 27 10:12:29 EST 2010
Hello everybody,
I would like to know how can I add a plane to a polydata ? because ehre what
I'm trying to do:
I have a PolyData that I clip using vtkClipPolyData (clipping function = ONE
plane). I manage to clip it and to display the clipped part. Unfortunately
this clipped polydata
has a missing plane... (the one who has been used to clip..) So as I result
I don't have a close polydata and.. it make wrong the calculation that I'm
doing after..
So here what I did to create the missing plane: I use vtkCutter but
vtkCutter creates lines where the cut function intersects the polydata. So I
will use
vtkStrippers then to puts them together into polylines. I then pull a trick
and define polygons using the closed line segements that the stripper
created..
vtkCutter * cutEdges = vtkCutter::New();
cutEdges->SetInput(myPolyData);
cutEdges->SetCutFunction(plane);
cutEdges->GenerateCutScalarsOn();
cutEdges->SetValue(0, 0.5);
vtkStripper * cutStrips = vtkStripper::New();
cutStrips->SetInputConnection(cutEdges->GetOutputPort());
cutStrips->Update();
vtkPolyData * cutPoly = vtkPolyData::New();
cutPoly->SetPoints(cutStrips->GetOutput()->GetPoints());
cutPoly->SetPolys(cutStrips->GetOutput()->GetLines());
// Triangle filter is robust enough to ignore the duplicate point at
// the beginning and end of the polygons and triangulate them.
vtkTriangleFilter * cutTriangles = vtkTriangleFilter::New();
cutTriangles->SetInput(cutPoly);
cutTriangles->Update();
so cutTriangles is my missing plane.. How can I add that to my clipped
polyData ?
Regards,
Francesco
--
View this message in context: http://old.nabble.com/Add-a-plan-to-a-vtkPolyData-tp27341078p27341078.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list