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

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


Hi Bill,

Thanks for the reply!

I already tried this but vtkClipPolydata will return all the points on one
side of the cutting plane. I need the points inside the cutting plane only.

For ex: if I move the origin of the cutting plane to

pPlane->SetOrigin(0,0,-0.1);

then vtkClipPolydata will return five points (the two cutting points and the
three points in the x-y plane). However, vtkCutter will return only the two
cutting points.

what do you think?

Thanks!


On Thu, Sep 16, 2010 at 2:33 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> You want vtkClipPolydata rather than vtkCutter.
>
> On Thu, Sep 16, 2010 at 11:29 AM, Dan Asimov <dan.asimov at gmail.com> wrote:
> > 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!
> >
> >
> > _______________________________________________
> > 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
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100916/099c3894/attachment.htm>


More information about the vtkusers mailing list