How about this technique... This would work as long as the two objects are not the exact same color.
Step one: Put object 1 on top of object 2 Take a snapshot of the rect that contains both objects Put the imagedata for that snapshot into tImageData1 Step two: Put object 2 on top of object 1 Take a snapshot of the rect that contains both objects Put the imagedata for that snapshot into tImageData2 If tImageData1 <> tImageData2 then return true Basically, the idea is that, as long as the visible portions do not overlap, the image of the rect that contains both objects will be the same, regardless of which is on top. If the image of that rect changes when the Z order changes, then they must overlap. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lynch, Jonathan Sent: Friday, June 24, 2005 11:54 AM To: How to use Revolution Subject: RE: is within ... polygon shape? This is pretty cool! But - would this work 100% for curved polygons or images? The docs do not mention points for images. Either, this is a very cool way of testing. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Hurley Sent: Friday, June 24, 2005 11:44 AM To: [email protected] Subject: Re: is within ... polygon shape? > >Message: 15 >Date: Fri, 24 Jun 2005 07:53:22 -0700 >From: Scott Rossi <[EMAIL PROTECTED]> >Subject: Re: is within ... polygon shape? >To: How to use Revolution <[email protected]> >Message-ID: <[EMAIL PROTECTED]> >Content-Type: text/plain; charset="US-ASCII" > >Recently, Steve Bonham wrote: > >> Intersect doesn't work after all. It appears that one object will >> intersect with another irregular object's rect and NOT the objects > > true shape (polygon points). >> See illustration... at: >> http://academics.georgiasouthern.edu/cet/SB/ball_fairway.jpg >> >> Is there a way to get Rev to: >> 1. evaluate IF the loc of an object is within the shape (defined by a >> series of coordinates) of an object? >> >> OR >> 2. evaluate IF the loc of an object intersects with the shape >> (defined by a series of coordinates) of an object? > >I believe some folks on the list have written collision detection routines >that can detect intersection in several situations. I think Malte Brill >might know something about this. > >That being said, collision detection on irregular shapes can work by using >images that have a transparent background and point references. Using the >within() function it is possible to accurately detect whether a point falls >within the image since Rev will evaluate a point falling within the >transparent region of the image as false. > > get within(img 1,myPoint) > >Regards, > >Scott Rossi >Creative Director >Tactile Media, Multimedia & Design Steve, Scott is right. The function you want is "within()", which is different from "is within." It is very efficient. If you want to detect whether two polygons Poly1 and Poly2 intersect, you would first run function firstWithinSecond grc1,grc2 put the points of grc grc1 into myPolyPoints1 repeat for each line tPoint in myPolyPoints1 if within(grc grc2,tPoint) then return "true" end repeat return false end firstWithinSecond where grc1 is Poly1 and grc2 is Poly2 and then run the same routine with Poly1 and Poly2 reversed. It may be that a point (vertex) of Poly2 is within Poly1, but there is no vertex of Poly 1 which is within Poly2. You need to run both. Or write one handler to check both. I didn't realize it worked for points within images as well. Thanks Scott. Jim _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
