Message: 15 Date: Mon, 28 Mar 2005 11:02:18 -0800 From: Jim MacConnell <[EMAIL PROTECTED]> Subject: Re: Math wizardry To: RevList <[email protected]> Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="US-ASCII"
Richard,
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.
Jim,
Perhaps even easier would be to define a function which determines the *geometrical* angle associated with a line in Run Rev. Any geometrical line rotated 180 degrees is the same geometrical line. Therefore the function below eliminates the signs associated with Run Rev angle.
function theGeometrialAngle p1,p2
--Geometrical angle of line defined by the two points p1 and p2
get the paramcount
if it is 1 then
put line 2 of p1 into p2
put line 1 of p1 into p1
end if
put item 1 of p2 - item 1 of p1 into dx
put item 2 of p2 - item 2 of p1 into dy
put atan2(dy,dx) into tAngle
--Add or subtract pi as needed.
switch
case tAngle < 0
return tAngle + pi
break
case tAngle > pi
return tAngle - pi
break
default
return tAngle
end switch
end theGeometrialAnglefunction tAngleBetween a1,a2 return abs(a1 - a2) end tAngleBetween
And so the geometrical angle between two Run Rev lines is just the absolute value of the difference.
Jim _______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
