-
well the function for inverse tan or arc tan is
atn
for the two lines:
if you got the end points of them you can calculate the slope. By that you can easily get the angle of one line. Now do that for both and add take the difference between the two angles.. there you go.
(I figure you know trig since you posted that... if you need more help post again)
-
1 Attachment(s)
Arie,
MisanThrOp is correct. I am attaching a .jpg file that shows two triangles and the math that needs to be done to calculate angular difference. The angle will be expressed in Radians, but I have included the conversion formula to degrees for your reference.
Regards,
ChuckB
-
-
And what about if one of the lines is strate (X1,Y1)-(X2,Y1), and how about more than 90 degrees? Explain more...
Thank you so far,
Arie.
-
1 Attachment(s)
Hi Arie,
Here is a small program that does two specific things.
1) You manipulate a variable fControlAngle (degrees) to rotate a line.
2) Another variable fCalcAngle is calculated from the slope of the rotating line.
Now, the Y axis increases as you go down vertically in the window. Notice that I inserted a negative sign for the numerator in the CalcAngle routine because of this
As you rotate notice also the sign change. To fix this, I have used a routine to determine which of the four quadrants the line is passing through and thereby applying a correction value. There may be a better way but have not tried to figure it out.
This may not be exactly what you are looking for but it may be helpful.
Regards,
ChuckB
-
1 Attachment(s)
Hi Arie,
Here is a small program that does two specific things.
1) You manipulate a variable fControlAngle (degrees) to rotate a line.
2) Another variable fCalcAngle is calculated from the slope of the rotating line.
Now, the Y axis increases as you go down vertically in the window. Notice that I inserted a negative sign for the numerator in the CalcAngle routine because of this
As you rotate notice also the sign change. To fix this, I have used a routine to determine which of the four quadrants the line is passing through and thereby applying a correction value. There may be a better way but have not tried to figure it out.
This may not be exactly what you are looking for but it may be helpful.
Regards,
ChuckB
-
Thank you, ChuckB!
I'll take a look at that.
Arie.