[vtkusers] PointInPolygon returns 1 for all points within bounds

Jothy jothybasu at gmail.com
Fri Jul 22 10:38:46 EDT 2011


Hi all,

I have a mesh generated from vtkDiscreteMarchingCubes and processed through
vtkDecimatePro and vtkWindowedSincPolyDataFilter. Now, I want to find the
points/voxels inside this mesh. I am using vtkPolygon::PointInPolygon. But,
the result is "1! for the all the points whichever falls with the bounds.

Here is the piece of code that I am using

(smoother is vtkWindowedSincPolyDataFilter)

 int npts=smoother->GetOutput()-> GetPoints()->GetNumberOfPoints();// test
point
 //double n[3]={0.707, 0.707, 0};
 double n[3];

  vtkSmartPointer<vtkPolygon> polygon =
           vtkSmartPointer<vtkPolygon>::New();
  *
polygon->ComputeNormal(mapper->GetInput()->GetPoints()->GetNumberOfPoints(),

static_cast<double*>(mapper->GetInput()->GetPoints()->GetData()->GetVoidPointer(0)),
n);      *

   double bds[6];
   smoother->GetOutput()->GetBounds(bds);
    qDebug()<< polygon->PointInPolygon(testIn,npts,*
static_cast<double*>(mapper->GetInput()->GetPolys()->GetData()->GetVoidPointer(0)
*),bds,n)<<"Result";

Are these two highlighted lines correct?

Many thanks

Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110722/134671ed/attachment.htm>


More information about the vtkusers mailing list