[vtkusers] vtkCutter doesn't return cells that are totally inside the cutting vtkPlane

Dan Asimov dan.asimov at gmail.com
Thu Sep 16 11:29:40 EDT 2010


Hi,

I'm new to vtk. So, forgive me for my simple question!

I'm trying to use vtkCutter on a vtkPolydata to get all the points inside a
specific plane. However, it seems vtkCutter doesn't return any cell that
lies completely inside the cutting plane!

Here is a very simple example in C++:

//Adding some points (3 of them in the x-y plane)
vtkPoints *pPoints = vtkPoints::New();
pPoints->InsertNextPoint(1,0,-0.5);
pPoints->InsertNextPoint(0,1,0);
pPoints->InsertNextPoint(-1,0,0);
pPoints->InsertNextPoint(0,-1,0);

vtkPolyData *pPolydata = vtkPolyData::New();
pPolydata->SetPoints(pPoints);

vtkPolygon *pPolygon = vtkPolygon::New();
pPolygon->GetPointIds()->SetNumberOfIds(4);
for (int i=0;i<4;i++)
{
    pPolygon->GetPointIds()->SetId(i,i);
}
pPolydata->Allocate(1,1);
pPolydata->InsertNextCell(pPolygon->GetCellType(),pPolygon->GetPointIds());

// The cutting plane is the x-y plane
vtkPlane *pPlane = vtkPlane::New();
pPlane->SetOrigin(0,0,0);
pPlane->SetNormal(0,0,1);

// Cut
vtkCutter *pCutter = vtkCutter::New();
pCutter->SetCutFunction(pPlane);
pCutter->SetInput(pPolydata);
pCutter->Update();
vtkPolyData *pCutterOutput = pCutter->GetOutput();

vtkPoints *Pts = pCutterOutput->GetPoints();
int nPts = Pts->GetNumberOfPoints();

now, the pCutterOutput contains only two points (0,1,0) & (0,-1,0). I was
expecting it will contain also (-1,0,0) since it's in the same plane (x-y
plane). Am I missing something??

Thanks for your help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100916/1677878e/attachment.htm>


More information about the vtkusers mailing list