is within ... polygon shape?

Scott Rossi scott at tactilemedia.com
Fri Jun 24 13:16:21 EDT 2005


Recently, Lynch, Jonathan  wrote:

>>> Put the points of image "myImage1" into field "feedback"

>>> Causes an error - it says this object does not have this property. I
>>> am misunderstanding something aren't I?

>> Images don't have points.  You simply test the point against the image
>> itself:

>> if within(img "myImage",myPoint) then answer "point is within the
>> image"

> Ah, but that only tests a single point. To be perfectly accurate, one
> would need to test every single non-transparent point in the image.

OK, let's use a golf analogy as an example.  Let's say you wanted to find
out if the ball is on the green:

  if within(img "green",loc of img "ball") then answer "ready to putt"

In this case you are testing the loc point of the ball against the opaque
region of the "green" image.  There is only one point to test.  You could go
further and test all the rect points of the ball as well: topLeft, topRight,
etc but this depends on how precise you want to be.

Does this make sense?

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list