View Single Post

  #4 (permalink)  
Old 05-13-2004
Winwaed's Avatar
Winwaed Winwaed is offline
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 916
Blog Entries: 11
If the polygons overlapped, you could check the point against each polygon in turn. Yes this could be slow, depending on the complexity and number of polygons. It can be greatly speeded up by comparing against the polygon's rectangular extents, and/or by sorting polygons.


re. the odd/even bit: Try it on a piece of paper. Draw a polygon. Start with a simple one like a square.
Point outside square:
- If ray misses square => 0 intersections
- If ray passes through square => 2 intersections
Point inside square:
- Ray always has one intersection

Try more complicated polygons with concave faces/etc, and you'll find an odd number of intersections occur when the point is inside the polygon.


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
See the Geoweb Guru for online mapping
Reply With Quote