geometry-challenged

Trevor DeVore lists at mangomultimedia.com
Sat Jan 24 19:05:16 EST 2004


On Jan 24, 2004, at 4:46 PM, Dar Scott wrote:

> On Saturday, January 24, 2004, at 04:09 PM, Trevor DeVore wrote:
>
>>   put item 1 of loc of button 2 - item 1 of loc of button 1 into 
>> tDeltaX
>>   put item 2 of loc of button 2 - item 2 of loc of button 1 into 
>> tDeltaY
>>   put atan2(tDeltaY, tDeltaX) into tRadianAngle
>>   put tRadianAngle * (180/pi) into tDegreeAngle
>>   put tDegreeAngle into field 1
>
> Though this can be done without trig, getting the angle like this has 
> the advantage of avoiding divide-by-zero problems.
>
>>   put ((width of button 1/2) * cos(tRadianAngle)) + item 1 of loc of 
>> button 1 into tNewX
>>   put ((height of button 1/2) * sin(tRadianAngle)) + item 2 of loc of 
>> button 1 into tNewY
>>   set loc of graphic 1 to tNewX,tNewY
>
> This looks fishy to me.
>
> I seems to me you have to figure out which side of the box the line 
> will be crossing.
>
> Of course, one has to figure out only one end of the problem because 
> the other end is done the same way.

I use similar calculations for moving objects around circles and they 
work well.  Download the test stack I posted which demonstrates it 
working with two buttons.


-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com



More information about the use-livecode mailing list