[vtkusers] Problems clipping a PolyData

Martin Bianculli mbianculli at cistib.upf.edu
Wed Oct 7 10:56:44 EDT 2009


Hello vtk world,

Basically, what I'm currently trying to do is to cut a vtkPolyData in two, using a loop of points. I'm using
vtkImplicitSelectionLoop to create the loop, and vtkClipPolyData to cut the vtkPolyData throughout the loop, which consists of a set of Points. For simplicity, the point's Id have been selected using paraView,

that shouldn't be the problem. The problem is that the output tends to be something like " a big crescent shape chopped out of the 3D model or a whole bunch  of tiny, irregularly  shaped holes." As it has been mentioned in a previous mail touching the same subject, but there is no answer to this thread. ([vtkusers] Cutting a hole in polydata)

I also tried to cut it using vtkExtractPolyDataGeometry (also using the same implicitLoop), and the results were different, but still they weren't what I expected.



here goes the code:


vtkSmartPointer<vtkImplicitSelectionLoop> loop = vtkImplicitSelectionLoop::New();

// The following points have been selected using ParaView from the aneurysm_with_vessels polyData
int myints[] = {5275, 4761,4520,4591,3314,1381,1037,718,574,905,2512,4099,4854,5521,5286,5274 };
vector<int> ids (myints, myints + sizeof(myints) / sizeof(int) );
vtkSmartPointer<vtkPoints > paraViewPoints = vtkPoints::New();
for( int i = 0; i < ids.size(); i++ )
{
   paraViewPoints->InsertPoint(i,inputMesh->GetPoint(ids.at(i)));
}
loop->SetLoop(paraViewPoints);

//clip polygonal data with user-specified implicit function vtkSmartPointer<vtkClipPolyData> clipper = vtkClipPolyData::New();
clipper->SetInput(inputMesh);
clipper->SetClipFunction( loop );
clipper->Update();

vtkPolyData* clippedOutput = clipper->GetOutput();



Thanks in advance!



Regards,



Martin.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091007/04417707/attachment.htm>


More information about the vtkusers mailing list