I want to calculate the angle between two lines, I found some code in the net that can calculate the angle between two vectors, now how can I procede, witch is the diference between a line and a vector ? does someone know a way to calculate the angle between two lines ?
Thank you for the moment
Best regards
Kurt
Maybe it’s clearer now, however, be aware that the function acos() returns an angle between zero and pi=3.14159… and if the actual angle is, say, 5pi/4, acos() will return 3pi/4 because they both have the same cosine and acos() couldn’t tell which one you want. So, you will need to know the sine of the angle as well, which is obtained by deviding the length of the cross product of the two vectors by the product of the lengths of the two vectors. If you want to know how this is done drop me a line.
Everything with the angle is working, in order to try I have drawn two lines in AutoCAD system, in AutoCAD I have the following lines |_, (with 90 degrees) but then when I use the coordinates that is the AutoCAD system I have the following lines in my system (also with 90 degrees but in a wrong way:
_
|
The code for the projection is :
glOrtho(500.0, -500.0, 500.0, -500.0, -1.0, 100.0)
Can someone explain me a bit ?
Thank youfor the moment
Best regards
Kurt
PS.: if someone want a picture of a screen shot of both systems (my application and AutoCAD) I can send it by email, just ask me.
The OpenGL coordinate system is set up in a different way. By default the Y axis goes up, not down. Flipping all your Y coordinates should take care of it