Page 1 of 1

How do I know if one object is within another object?

Posted: Fri Oct 24, 2014 5:33 am
by genie
Good day y'all!


I have a question...

How do I know if one object is within another object? (that they fully overlap)

I know "intersect", but it only tells when 2 objects collide, right?

Also, "within" only tells if a point is within an object, not object within the object.

Can't seem to find what to use.


And another question...

How do I tell if one object directly beside another object? By object, I mean controls with irregular shape. You can think of like I am trying to assemble pieces of something and I like to know if 2 pieces are connected. By connected I mean to say there shouldn't be any hollow/empty pixel between the two.


Thank you so much!


Any insights will be greatly appreciated.


Regards,
Genie

Re: How do I know if one object is within another object?

Posted: Sat Oct 25, 2014 12:15 pm
by jmburnod
Hi Genie
How do I know if one object is within another object? (that they fully overlap)
Also, "within" only tells if a point is within an object, not object within the object.
You can use within for each point of your object. Points if this is an irregular polygon or topleft,topright... if this is an other object
Best regards
Jean-Marc

Re: How do I know if one object is within another object?

Posted: Sun Oct 26, 2014 3:46 pm
by genie
jmburnod wrote: You can use within for each point of your object. Points if this is an irregular polygon or topleft,topright... if this is an other object
Ohh, i see. Sound tedious...but thank you so much for your help jm. :) Now I know what to do!

Regards,
Genie

Re: How do I know if one object is within another object?

Posted: Sun Oct 26, 2014 4:51 pm
by jmburnod
Now I know what to do!
Yes for the first part but what about the second ?
How do I tell if one object directly beside another object?
:D
Best regards
Jean-Marc

Re: How do I know if one object is within another object?

Posted: Sun Oct 26, 2014 5:16 pm
by newtronsols
you could have invisible objects next to the visible - like a boundary. Then test for intersect e.g. a slightly larger invisible outer circle or a slightly larger invisible outer box.

Re: How do I know if one object is within another object?

Posted: Sun Oct 26, 2014 5:31 pm
by FourthWorld
I stumbled across a function from the use-livecode list for this:
http://lists.runrev.com/pipermail/use-l ... 61156.html