[OT] Poll: What does it mean for 1 rect to be 'within' a certain distance of another rect?

Paul Dupuis paul at researchware.com
Tue Feb 16 13:15:23 EST 2021


Thank you. I think I understand the proposed approach. I appreciate the 
clarification.

On 2/16/2021 1:02 PM, David V Glasgow via use-livecode wrote:
> Well, my suggestion a non starter if you need to do hard sums, and you eschew invisibles.
>
> However, my thinking was this... I understood that the task was to detect when two rectangles r1 and r2 were within distance d of each other.   Presumably ether a flat bit or a pointy bit, coming in at any angle.  if each rectangle is centred and grouped with a rect that is bigger by d/2, any intersection of any two bigger rects means that the smaller corresponding r1 and r2 rects are at or within the desired distance d (half d measured by r1’margin over r1, and half by r2’margin over r2). The size of the groups is ignored, and as long as all r & r’ stay centred it should work, unless the rects move super quickly.
>
> Oh.  It just occurred to me is that the bigger rects would have to have rounded corners.  Hmmm.
>
>
> OK, I’ll just sit back and see how it should be done.
>
> Cheers
>
> David G
>
>
>
>> On 16 Feb 2021, at 5:08 pm, Paul Dupuis via use-livecode <use-livecode at lists.runrev.com> wrote:
>>
>> On 2/16/2021 6:16 AM, David V Glasgow via use-livecode wrote:
>>> Being a bear of little brain, I would try placing each rect into a group centred on a larger rect, where the margin is d/2,  then test using intersect.
>>>
>>> Now, where did I put that hunny?
>>>
>>>
>> Like the pooh reference!
>>
>> Although I am not sure I follow exactly what you are suggests - AND - I need to do this via math rather than visible (or invisible) objects in LC.
>>
>> for rects r1,r2, I have l1,t1,r1,b2 and l2,t2,r2,b2 for their coordinates. The rect min(l1,l2),min(t1,t2),max(r1,r2),max(b1,b2) is a rectangle that exactly bounds both rects - this would be the rect of the group (if you created them as objects and grouped them (less margins/borders).
>>
>> I don't follow the part about 'centered on a larger rect where the margin is d/2?
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list