Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by bobf (Monsignor)
on Aug 28, 2006 at 21:18 UTC ( #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. :-)


Comment on Re^3: Speeding up point-in-polygon -- take two
Download Code
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
Node Status?
node history
Node Type: note [id://570051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2014-07-10 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (199 votes), past polls