[vtkusers] get a point inside a vtkPolyData

Jonathan Morra jonmorra at gmail.com
Fri Feb 25 13:00:32 EST 2011


I understand everything except the last part.  How do I know if I move
epsilon along the vector I have my point?

On Fri, Feb 25, 2011 at 9:55 AM, David Doria <daviddoria at gmail.com> wrote:

> 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/22b96f3c/attachment.htm>


More information about the vtkusers mailing list