Re: Point in Poly
Just a quick thanks to all those who took the time to contribute to this thread! Let of great ideas. On May 29, 2013, at 2:22 PM, J. Landman Gay wrote: On 5/29/13 11:33 AM, Roger Guay wrote: What a cool idea! I also wonder if blending will work? It does. In fact, when I need an opaque object to get info that doesn't work with transparent objects, I sometimes set the blendlevel to 1. Visually it still looks transparent but all the color/intersect/etc functions still work. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
On May 29, 2013, at 8:17 AM, Ray Horsley wrote: Is there a way to determine if a point is inside of a polygon graphic, and not necessarily inside the graphic's containing rectangle? Ray, Have you tried the within() function? It works the way you describe for images, but I'm not sure about graphics objects. Devin Devin Asay Office of Digital Humanities Brigham Young University ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
If it doesn't work the same with graphics you could cheat and snapshot, overlay, check, delete the snapshot. On Wed, May 29, 2013 at 8:44 AM, Devin Asay devin_a...@byu.edu wrote: On May 29, 2013, at 8:17 AM, Ray Horsley wrote: Is there a way to determine if a point is inside of a polygon graphic, and not necessarily inside the graphic's containing rectangle? Ray, Have you tried the within() function? It works the way you describe for images, but I'm not sure about graphics objects. Devin Devin Asay Office of Digital Humanities Brigham Young University ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
On 05/29/2013 05:44 PM, Devin Asay wrote: On May 29, 2013, at 8:17 AM, Ray Horsley wrote: Is there a way to determine if a point is inside of a polygon graphic, and not necessarily inside the graphic's containing rectangle? Unfortunately my feeble attempt with: on mouseDown grab me end mouseDown on mouseStill Down if the loc of me is within the filled of graphic XXX then put inside into fld INN else put empty into fld INN end if end mouseStillDown resulted in no joy as THE FILLED was invented by me :( and, of course, 'the rect' is no use at all. Richmond. Ray, Have you tried the within() function? It works the way you describe for images, but I'm not sure about graphics objects. Devin Devin Asay Office of Digital Humanities Brigham Young University ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
On Wed, May 29, 2013 at 9:44 AM, Devin Asay devin_a...@byu.edu wrote: Have you tried the within() function? It works the way you describe for images, but I'm not sure about graphics objects. This works for graphics objects as well, as long as their opaque is true. within(grc 1,the loc of btn 1) -- true if the point is within the actual graphic, not just the rect. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
if the grc is set to opaque (or selected) it works fine, if within(grc mygrc, the loc of me) then On Wed, May 29, 2013 at 9:25 AM, Richmond richmondmathew...@gmail.comwrote: On 05/29/2013 05:44 PM, Devin Asay wrote: On May 29, 2013, at 8:17 AM, Ray Horsley wrote: Is there a way to determine if a point is inside of a polygon graphic, and not necessarily inside the graphic's containing rectangle? Unfortunately my feeble attempt with: on mouseDown grab me end mouseDown on mouseStill Down if the loc of me is within the filled of graphic XXX then put inside into fld INN else put empty into fld INN end if end mouseStillDown resulted in no joy as THE FILLED was invented by me :( and, of course, 'the rect' is no use at all. Richmond. Ray, Have you tried the within() function? It works the way you describe for images, but I'm not sure about graphics objects. Devin Devin Asay Office of Digital Humanities Brigham Young University __**_ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/**mailman/listinfo/use-livecodehttp://lists.runrev.com/mailman/listinfo/use-livecode __**_ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/**mailman/listinfo/use-livecodehttp://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
What Geoff said. Another way is: on mouseMove if the mouseloc is within the rect of grc 1 then put the mouseColor end mousemove The mouseColor is a function that works only on the properties of the current mouseLoc. It has one advantage in that it can tell when the mouse is outside the rect, inside the rect, or inside an opaque graphic within that rect. Craig Newman -Original Message- From: Geoff Canyon gcan...@gmail.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Wed, May 29, 2013 11:35 am Subject: Re: Point in Poly On Wed, May 29, 2013 at 9:44 AM, Devin Asay devin_a...@byu.edu wrote: Have you tried the within() function? It works the way you describe for images, but I'm not sure about graphics objects. This works for graphics objects as well, as long as their opaque is true. within(grc 1,the loc of btn 1) -- true if the point is within the actual graphic, not just the rect. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
I like the idea of trying to get within() to work. But if that does not work, try computing. Consider a horizontal line through the point. Find the points where it crosses the line segments of the sides. (Take care of the special case of a line segment being on your horizontal line.) Count the points to the left of your point. If it is odd, then the point is inside. Dar On May 29, 2013, at 8:17 AM, Ray Horsley wrote: Is there a way to determine if a point is inside of a polygon graphic, and not necessarily inside the graphic's containing rectangle? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
On Wed, May 29, 2013 at 10:44 AM, Dar Scott d...@swcp.com wrote: Consider a horizontal line through the point. Find the points where it crosses the line segments of the sides. (Take care of the special case of a line segment being on your horizontal line.) Count the points to the left of your point. If it is odd, then the point is inside. Ah, the CS 202 solution -- I was wondering if anyone would bring this up. You're giving me flashbacks, Dar ;-) ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
Of course you might also want to take a look at the animationEngine sourcecode, which has a function for that. ;-) Cheers, Malte -- derbrill IT-service Malte Pfaff-Brill Tanneneck 2, d-24790 Ostenfeld Tel: +49 4331-337 640 0 eMail: i...@derbrill.de web: http://www.derbrill.de Steuernummer: 28 015 03865 VAT ID: DE223571286 ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
What's wrong with intersect(grc pointThing, grc polyThing, pixels)? Assuming opaque polygon, of course. Roger On May 29, 2013, at 7:17 AM, Ray Horsley r...@linkit.com wrote: Is there a way to determine if a point is inside of a polygon graphic, and not necessarily inside the graphic's containing rectangle ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
It seems opaque has come up several times. I wonder if that can be set temporarily inside lock screen and get the right results for polygons that are not opaque. Dar On May 29, 2013, at 10:07 AM, Roger Guay wrote: What's wrong with intersect(grc pointThing, grc polyThing, pixels)? Assuming opaque polygon, of course. Roger On May 29, 2013, at 7:17 AM, Ray Horsley r...@linkit.com wrote: Is there a way to determine if a point is inside of a polygon graphic, and not necessarily inside the graphic's containing rectangle ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
What a cool idea! I also wonder if blending will work? I'm going to go play. Thanks! On May 29, 2013, at 9:27 AM, Dar Scott d...@swcp.com wrote: I wonder if that can be set temporarily inside lock screen and get the right results for polygons that are not opaque. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
Well: I made a stack with a regular polygon shape (7 sides) filled with a very 'fetching' green, and a field called INN, and put this script into the graphic: on mouseWithin put the mouseColor into fld INN end mouseWithin and . . . when the mouse was WITHIN the coloured polygon I got 83,195,64 i.e. the fetching green and when inwith the bounding rect but outwith the polygon I got 237,237,237 so there you go; all done and dusted :) Richmond. P.S. Ooooh, and by the way Happy Campers if you don't feel in the mood for a fetching green why not go for a more moody 'Rose' or even a 'Gay Grenache'; it will go well with your scarf! ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Point in Poly
Is the opaque pixelx functionality fixed for the current version (with intersect)? It was broken in 6.0 community. On Wed, May 29, 2013 at 10:35 AM, Richmond richmondmathew...@gmail.comwrote: Well: I made a stack with a regular polygon shape (7 sides) filled with a very 'fetching' green, and a field called INN, and put this script into the graphic: on mouseWithin put the mouseColor into fld INN end mouseWithin and . . . when the mouse was WITHIN the coloured polygon I got 83,195,64 i.e. the fetching green and when inwith the bounding rect but outwith the polygon I got 237,237,237 so there you go; all done and dusted :) Richmond. P.S. Ooooh, and by the way Happy Campers if you don't feel in the mood for a fetching green why not go for a more moody 'Rose' or even a 'Gay Grenache'; it will go well with your scarf! __**_ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/**mailman/listinfo/use-livecodehttp://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode