One thing that might help is that if you have a point P that you know
is in the polygon, then
For any other point Q in the polygon, the segment PQ will cross the
polygon(boundary) an even number of times and for any point Q outside
the polygon the segment PQ will cross the boundary an odd number of
times. A special case of that is that if it is a convex polygon (P
could be the loc) then PQ will not cross the boundary at all if Q is
inside and PQ will cross exactly once if Q is outside. Hope this helps,
- Mick
PS you might have to consider PQ running along one of the boundary
segments if P is not chosen so as to avoid that
On May 16, 2008, at 1:00 PM, [EMAIL PROTECTED]
wrote:
Message: 14
Date: Fri, 16 May 2008 11:35:39 +0100
From: "David Bovill" <[EMAIL PROTECTED]>
Subject: Polygon geometry - any suggestions?
To: "How to use Revolution" <use-revolution@lists.runrev.com>
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1
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?
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution