[vtkusers] PoinInPolygon arguments
David Doria
daviddoria+vtk at gmail.com
Wed Apr 7 19:43:49 EDT 2010
On Tue, Apr 6, 2010 at 11:33 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> n is the normal to the face of the polygon
> numPts is the number of points in the polygon
> pts is an array of xyz points
The call was pretty nasty:
double n[3];
polygon->ComputeNormal(polygon->GetPoints()->GetNumberOfPoints(),
static_cast<double*>(polygon->GetPoints()->GetData()->GetVoidPointer(0)),
n);
double bounds[6];
polygon->GetPoints()->GetBounds(bounds);
cout << "test x in polygon? " << polygon->PointInPolygon(x,
polygon->GetPoints()->GetNumberOfPoints(),
static_cast<double*>(polygon->GetPoints()->GetData()->GetVoidPointer(0)),
bounds, n) << endl;
I just wrote a convenience function and submitted it to the developers
mailing list. If it is approved, in the future you can simply call
cout << "test x in polygon? " << polygon->PointInPolygon(x) << endl;
Thanks,
David
More information about the vtkusers
mailing list