Re: Polygon geometry - any suggestions?

2008-05-17 Thread David Bovill
Thanks I'll test it - whatever it does :)
___
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


Polygon geometry - any suggestions?

2008-05-16 Thread David Bovill
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


Re: Polygon geometry - any suggestions?

2008-05-16 Thread Colin Holgate
Don't know if this would work out for you, but you can have a simple  
image that you check the color of pixels to tell where you are. I used  
that method in this thing I did:


http://staff.funnygarbage.com/colin/track/track.mov

The stack is here:

http://staff.funnygarbage.com/colin/track.rev.zip

Once we did a golf game, where you had to hit the ball onto various  
greens (using perspective 3D), and by checking the color of the pixel  
you landed on it was possible to know whether you were on a green, and  
on which one, even if the areas were broken up into multiple strange  
shaped blobs.



___
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


Re: Polygon geometry - any suggestions?

2008-05-16 Thread David Bovill
Interesting idea - would be more flexible and powerful too. Still I'd rather
do simple text based geometry as eventually this should be a CGI? This is
the only one I've found so far - does my head in to look at it :)

   - Within Polygon
Algorithmhttp://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html#The%20Method
___
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


Polygon geometry - any suggestions?

2008-05-16 Thread R. Hillen

Hello David,

I use the following function (sorry, but I forgot, who created it)

function ptInPoly p, pts
  put false into inside
  put item 1 of p into xt
  put item 2 of p into yt
  put item 1 of line 1 of pts into xOld
  put item 2 of line 1 of pts into yOld
  repeat with i = 2 to the number of lines in pts
put item 1 of line i of pts into xNew
put item 2 of line i of pts into yNew
if (xNew  xOld) then --flip
  put xOld into x1
  put xNew into x2
  put yOld into y1
  put yNew into y2
else
  put xNew into x1
  put xOld into x2
  put yNew into y1
  put yOld into y2
end if
if (xNew  xt) = (xt = xOld) and  ((yt-y1)*(x2-x1))  ((y2- 
y1)*(xt-x1)) then put not inside into inside

put xNew into xOld
put yNew into yOld
  end repeat
  return inside
end ptInPoly




From: David Bovill [EMAIL PROTECTED]
Subject: Polygon geometry - any suggestions?
..
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.



Richard
___
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


polygon geometry

2008-05-16 Thread Mick Collins
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