Polygon geometry - any suggestions?

David Bovill david at openpartnership.net
Fri May 16 06:35:39 EDT 2008


I am working with maps and geo-tagging media files - as part of this I need
to work out if a point is within an area - simplest case a polygon, but this
could be a simple volume - that is a polygon extruded to the ground.

The coordinates are latitude and longitude in degrees - with heights in
metres - so a 3D point looks like:

-0.1055509873752101,51.56310290997875,23


and a simple volume based on a polygon (23 metres high) extruded to the
ground looks like this:

-0.1055509873752101,51.56310290997875,23
-0.1057556880140851,51.56295803562467,23
-0.1056108205764588,51.56284448695596,23
-0.1055509873752101,51.56310290997875,23

The question is how to determine if a point is within this polygon / volume.
What approach to take? has anyone done this before in Rev?

Ideally there would be a simple algorithm - but so far I can't find one - so
a basic hack would be to translate the geometry to screen based pixels and
construct Rev polygons and then use the built in within(object, point)
function? Not the fastest and definitely hacky - any suggestions regarding a
better way?



More information about the use-livecode mailing list