[vtkusers] Add a plan to a vtkPolyData

Frantch le_maitre at bluewin.ch
Wed Jan 27 10:32:36 EST 2010


Amazing :p

Yep, it works the polyData are combined AND the computations I do after work
too !

Thank you,
Francesco


David Doria-2 wrote:
> 
> On Wed, Jan 27, 2010 at 10:12 AM, Frantch <le_maitre at bluewin.ch> wrote:
>>
>> 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
> 
> If I read that correctly, the problem boils down to simply wanting to
> combine two polydata's, correct? If so, you can use the
> vtkAppendPolyDataFilter:
> http://www.vtk.org/Wiki/VTK/Examples/CombinePolydata
> 
> Let us know if that does what you need.
> 
> Thanks,
> 
> David
> _______________________________________________
> 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
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 

-- 
View this message in context: http://old.nabble.com/Add-a-plan-to-a-vtkPolyData-tp27341078p27341422.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list