On Fri, Apr 11, 2008 at 5:47 AM, 80n <<a href="mailto:80n80n@gmail.com">80n80n@gmail.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You can have any shaped bbox you like as long as it is a rectangle ;)<br><br>Can anyone point me to a good algorithm for selecting points within an arbitrary polygon?<br><font color="#888888"><br>80n</font></blockquote></div>
<br>I don't have it in pseudocode, but one I've heard of casts a ray (horizontal is common) out from the point being tested and then checks the intersection of that ray against each segment of the polygon. If the total number of intersections is odd, then the point lies inside the polygon. If the number is even, then it's outside. This works for holes in a polygon, too.<br>
<br>Karl