Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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. :-)

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://570051]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2017-10-19 04:05 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (251 votes). Check out past polls.