Math wizardry

Jim MacConnell jmac at consensustech.com
Tue Mar 29 10:35:46 EST 2005


>>> All of these give different values for the resulting angles, depending
>>> on the direction from which the lines are drawn. How do I consistently
>>> determine the angle between the two lines?
>> 
>> I think you may want to take a different approach. Since the user is drawing
>> the lines, it sounds like you actually know the "coordinates" of three
>> points, (Call them A, B and C). That means you know everything you need to
>> know to define all the angles.
>> 
>> (snip)
>> 
>> The advantage here is that there are no signs to deal with... The only thing
>> that matters is the length between points.
>> 
>> Now if you want to know the angles of the two lines in real space, calculate
>> the angle of LineAB (or another) and use addition to get the others.
> 
> 
> Perhaps even easier would be to define a function which determines
> the *geometrical* angle associated with a line in Run Rev.

I like this solution to Richard's problem and it is probably a little
faster, particularly if the angle between the lines is all we're after. If
we want magnitude, etc. the LOC gives you all of that. Simply a case of more
effort to get more info?  Which is a waste if you don't really need the
info... Also I just have a thing for the Law of Cosines....

jim 




More information about the use-livecode mailing list