Test for "within graphic"?

Ken Ray kray at sonsothunder.com
Wed Mar 24 14:40:22 EST 2004


> For example the following beeps when two polygons intersect:

Cool stuff...

> Notice that
> 
>      If tPoint is within the rect of grc  "myPoly"
> 
> is not the same as
> 
>     if within(grc "myPoly,tPoint)
> 
> although the docs says they should be.
> 
> I confess this is a bit confusing, since "put the rect of grc 
> "myPoly" yields the four rectangular points defining the rect of 
> "myPoly," and not the set of points which define the vertices.

Actually, the confusing part is that the docs say that "within()" and "is
within" are the same. One tests if a point is within *an object*, other
tests if a point is within *the rect of an object*. Which is why saying 'put
the rect of grc "MyPoly"' gives you the four points defining the rect of the
bounding box around "myPoly", whereas asking 'put the points of grc
"MyPoly"' will give you a list of all the vertices.

HTH,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/




More information about the use-livecode mailing list