Community of VE/MapPoint Users and Developers
This is a discussion on Determing Whether A Point Is Located Inside Polygon within the MP2K Magazine Articles forums, part of the Map Forums category; Wilfried Mestdagh wrote this article on determing whether a vehicle is located inside or outside a convex polygon. "Simplify ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Determing Whether A Point Is Located Inside Polygon Article at -- Determing Whether A Point Is Located Inside Polygon |
| ||||
| Re: Determing Whether A Point Is Located Inside Polygon
There is also a "ray" algorithm, where you project a line from your point to infinity. Count the number of times the line crosses the boundary of the polygon. If it is odd, then the point is in the polygon. For a sphere then you probably want to project along a line of latitude or longitude, and make assumptions about the shape not including the international date line, north pole, or something similar (eg. project to 180deg). Sedgwick's "Algorithms" has a nice optimisation of the above algorithm (for a plane). I'm probably going to be coding it up in C# for MapPoint in the next few months, so if Eric is interested then I might be persuaded to write an article about it... Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| ||||
| Re: Determing Whether A Point Is Located Inside Polygon
Sorry I forgot to reply earlier. This actually came up at a job site a couple weeks ago, a person started to describe it so I said "yes of course the ray algorithm" having read your post. I actually have C code for it although I won't pretend to understand how it all works yet.. To answer your question - yes I think it would be a terrific topic for an article, very practical for MapPoint developers. Eric |
| ||||
| Re: Determing Whether A Point Is Located Inside Polygon
I'm getting close to implementing something. I have found a reference to extending Wilfried's to work with concave polygons. Basically, you have to check all triangles and count the number that contain the point. If the number is odd, then the point is in the shape. It is from a review of different strategies and speeds in Graphics Gems IV. Chapter 1.4 "Point in Polygon Strategies" pp 24-46. This further quotes Berlin 1985 "Efficiency considerations in image synthesis", SIGGRAPH '85 State of the Art in Image Synthesis seminar notes, July 1985. It looks like the triangle method using pre-stored half planes is the fastest option for polygons with small numbers of vertices. There's an interesting angle method (ch 1.3 in Gems IV) which doesn't even involve trigonometry because it can be optimized to simple quadrant classification. The benchmarks suggest it is slightly slower than the "ray" ("Crossings" they call it) algorithm, but should be pretty close with a good optimizing compiler. Of course, all these standard discussions are for 2d Euclidean Space. We need something for a sphere. A polygon on a sphere has two "sides" - as I see it, the only difference between the inside and the outside is the size. The area of the inside is smaller than the area of outside. I think we'll need trigonometry for the spherical coordinates. I'll see what I come up with. C# and on a sphere. I'll be using my own objects, rather than MapPoint Locations. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
![]() |
| ||||
| Posted By | For | Type | Date | |
| Reverse Geocoding, Pt. III - MapPoint Articles - MP2K Magazine | This thread | Refback | 03-15-2007 01:17 PM | |
| MapPoint Articles - MP2K Magazine | This thread | Refback | 03-06-2007 02:52 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can I get the territory code that a pushipin is located | paf33 | MapPoint 2006/2009 Discussion | 7 | 06-08-2006 04:45 AM |
| Which Territory is a Pushpin located? | johnweidauer | MapPoint 2006/2009 Discussion | 1 | 07-31-2005 10:46 AM |
| How to programatically tell if an address is located? | jharbaugh | MapPoint 2006/2009 Discussion | 5 | 01-06-2005 09:26 PM |
| Determing the Time Zone in MapPoint | Anonymous | MP2K Magazine Articles | 0 | 02-26-2004 10:05 AM |
| gettign teh area inside a polygon or territory | Anonymous | MapPoint 2006/2009 Discussion | 1 | 10-18-2003 05:21 PM |
Cheap Flights to Benidorm
Book cheap flights to Benidorm with Holiday Hypermarket. Whether Summer or Winter Benidorm is a great destination.
Spain Holidays
Find and book Spain Holidays with Travel Counsellors. Holiday destinations around the world including Spain.
Turkey Holidays
Istanbul is Turkey's prime attraction as it has the most beautiful mosques and palaces of the country; it has Byzantine churches and Roman temples. Book Turkey Holidays online.
Dubai Holidays
Dubai holidays provide you with exotic sights, desert safaris and superb cuisine. There is an extensive range of things to do and see!
Cheap Portugal Holidays
Want to know what the best time to book cheap Portugal holidays is? Well have a look on ulookubook.com for some useful information to save your cash. Golf, tennis and cycling are all very popular here.
Travel
Check out the travel options on Travel.co.uk.
Cheap Goa Holidays
Experience the world famous Wednesday Flea Market at Anjuna! Book cheap Goa holidays at On The Beach!