Can someone tell me what series of instructions are necessary to determine the size of an angle in degrees or brads or radians or grads given the points which determine a line. For instance if I have a line with endpoints X1,Y1 and X2,Y2 how do I determine the angle this line makes with either the X or Y axis. Certainly I can determine the slope of the line and even the trig functions such as SIN, COS, TAN etc, but how do I determine the size of the angle in degrees or brads or radians or grads.
I use CALL GETMOUSE() and WHILE FN BUTTON to determine starting and ending positions of the mouse and draw a line between these points.
If X1,Y1 and X2,Y2 are these point coordinates, imagine a triangle with the abovementioned line as one side and two other sides, one vertical, one horizontal.
Size of horizontal side :
CoteAdj% = ABS(X2 - X2)
Size of vertical side :
CoteOpp% = ABS(Y2 - Y1)
The angle in radians is :
AngleRad# = ATN(CoteOpp%\CoteAdj%)
and in degrees :
AngleDeg# = (AngleRad# * 360.0) \ (2.0 * 3.14159)