Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Speeding up point-in-polygon -- take two

by bobf (Monsignor)
on Aug 28, 2006 at 21:18 UTC ( [id://570051]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Speeding up point-in-polygon -- take two
in thread Speeding up point-in-polygon -- take two

Once I get a bunch of potential points within the rect of a poly, I should find the 4 outermost points in each dimension. Once I determine those four definitively, all points within those 4 would be also within that poly, and I wouldn't have to do the checks for them.

If I understand you correctly, then given the polygon below and the four points marked as dots ("."), wouldn't that method determine that the point marked with an "x" is inside the polygon?

_________ | . ./ | / | /x | \ | \ | . .\ ---------

If all of your polygons were guananteed to have internal angles > 90 degrees that might work, but you only said that they were "irregular". I had a similar idea yesterday (except mine was finding the maximum internal bounding rectangle for the polygon rather than using the query points themselves), and discarded it for this reason. :-)

Replies are listed 'Best First'.
Re^4: Speeding up point-in-polygon -- take two
by punkish (Priest) on Aug 28, 2006 at 21:28 UTC
    yes, you are correct. Since I posted the above, I too figured all manner of cases when my assumption wouldn't work. Shucks, and thanks for confirming.
    --

    when small people start casting long shadows, it is time to go to bed

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://570051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-24 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found