is within ... polygon shape?

Lynch, Jonathan bnz2 at cdc.gov
Fri Jun 24 11:24:21 EDT 2005


Yes, but the mathematical testing for such a thing is not easy...

I mean, if it was a simple shape, with a simple formula to define the
shape, then it probably would not be so hard.  But, with an irregular
polygon, you have to do something like this:

Outer repeat loop (goes through every visible point in the bottom shape)
Put the point to be tested into tPoint1
  Inner repeat loop (goes through every visible point in the top shape)
    Put the point to be tested into tPoint2
    If tPoint2 = tPoint1 then
      Return true
      Exit this function
    End if	
  End inner repeat loop
End outer repeat loop

Doing that in transcript would be kind of slow. I imagine there must be
faster algorithms, but they will all require tons of comparisons.


-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of MisterX
Sent: Friday, June 24, 2005 11:08 AM
To: 'How to use Revolution'
Subject: RE: is within ... polygon shape?

if it's all white, then what? ;)

nothing beats mathematics ;)

cheers
1/X 

> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com 
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of 
> Steve Bonham
> Sent: Friday, June 24, 2005 16:55
> To: How to use Revolution
> Subject: Re: is within ... polygon shape?
> 
> Eric,
> 
> Wow!
> Now THAT is an ingenious approach!!! :-) and it might be just 
> the solution needed.
> 
> I'll give it a shot.
> 
> S
> 
> 
> 
> >Re Steve,
> >
> >Another funny approach:
> >
> >function WhichObject pLoc,pObj
> >   local tCurLoc, tColor
> >   -----
> >   put the screenMouseLoc into tCurLoc
> >   lock screen
> >   hide pObj
> >   set the screenMouseloc to globalLoc(pLoc)
> >   put the mouseColor into tColor
> >   set the screenMouseloc to tCurLoc
> >   show pObj
> >   unlock screen
> >   return WhatKindOfObject(tColor)
> >end WhichObject
> >
> >WhatKindOfObject function would return the right object according to 
> >the passed  color  :-) Not tested... but should work.
> >Ah, there are so many ways to do a job with Rev!
> 
> -- 
> 
> 
> --------------------------------------------------------------
> ------------------------------------
> Steve Bonham
> Director, Faculty Technology Development Laboratory Center 
> for Excellence in Teaching - Georgia Southern University 
> Statesboro, GA 30460-8143
> --------------------------------------------------------------
> ------------------------------------
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage 
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list