[vtkusers] get a point inside a vtkPolyData

David Doria daviddoria at gmail.com
Fri Feb 25 12:55:15 EST 2011


On Fri, Feb 25, 2011 at 12:51 PM, Jonathan Morra <jonmorra at gmail.com> wrote:

> Even if I make a vtkPolygon, I still have to loop over a whole bunch of
> points (potentially) to get one that is inside the contour.  I was wondering
> if there was a way to do this without loops.
>


Ah, my mistake, I misread your original post.

If all you want is any point inside of the polygon, how about:
- Pick a point on the polygon (one of the points in your contour)
- Pick a random vector in the plane of the polygon
- Move epsilon along that vector
- Do the point in polygon test
- If it passes, you have your point
- If it fails, move -epsilon along the vector and you have your point

Does that make sense?

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


More information about the vtkusers mailing list