<div class="gmail_quote">On Fri, Feb 25, 2011 at 12:51 PM, Jonathan Morra <span dir="ltr">&lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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.<div><div></div><div class="h5">
</div></div></blockquote></div><br><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">Ah, my mistake, I misread your original post.</div><div><br></div><div>If all you want is any point inside of the polygon, how about:</div>
<div>- Pick a point on the polygon (one of the points in your contour)</div><div>- Pick a random vector in the plane of the polygon</div><div>- Move epsilon along that vector</div><div>- Do the point in polygon test</div>
<div>- If it passes, you have your point</div><div>- If it fails, move -epsilon along the vector and you have your point</div><div><br></div><div>Does that make sense?</div><div><br>David</div>