maths - sin between vectors

Started by
7 comments, last by GameDev.net 18 years, 1 month ago
whats the easiest way to get the sin of the angle between two vectors? i could only think of doing sin(acos(dot(x,y)), (is that even right?) but thought there is probably a simpler way.
Advertisement
|| A x B || = ||A|| ||B|| sin(angle)
WhardieJones, hi dude - do you mean || A dot B || = ||A|| ||B|| sin(angle) ?

I use something like Angle = ArcSin ( (A•B) / (|A|*|B|) )
BinaryStylusOur greatest glory lies NOT in never falling, but in rising again - every time we do.Only the dead have seen the end of the war
Quote:Original post by WhardieJones
|| A x B || = ||A|| ||B|| sin(angle)

The formula is not correct.
A.B = |A||B| cos(angle)
A perpendicular to B gives A.B = 0 and sin(pi/2) = 1 AFAIK.

Together with sin*sin+cos*cos = 1 you end up with
                    A.Bsin(a) = sqrt(1 - (------)2)                   |A||B|


'.' beeing the dot product, of course.

This is another solution to your problem. I guess you'll find many more (playing with sin, cos and tan is rather fun :)) be aware that you are limited to values of sin(a) that are in [0,1] - ie a in[0,pi]. In fact, the formula dont' allow you to know if you are in [0,pi] or in [pi,pi*2] (because of the sqrt)

Regards,
Quote:Original post by Emmanuel Deloget
Quote:Original post by WhardieJones
|| A x B || = ||A|| ||B|| sin(angle)

The formula is not correct.
A.B = |A||B| cos(angle)
I think he means for x to be the cross product, in which case the formula is correct.
||A x B|| = ||A|| ||B|| sin(angle) - cross product
||A . B|| = ||A|| ||B|| cos(angle) - dot product

Quote:
|| A x B || = ||A|| ||B|| sin(angle)


Quote:Original post by Emmanuel Deloget
'.' beeing the dot product, of course.


'x' being the cross product, of course.
Quote:Original post by Anonymous Poster
Quote:
|| A x B || = ||A|| ||B|| sin(angle)


Quote:Original post by Emmanuel Deloget
'.' beeing the dot product, of course.


'x' being the cross product, of course.


Thanks for the clarification, mister anonymous poster [razz]

Since it was not very clear that the OP needed to have a 3D formula, I incorrectly assumed that cross product wouldn't be used. Thus, in my mind, the answer was "dot product" and I thought the formula was wrong.

I praise you, dear AP, to allow me to apologize for this horrible, terrible, deadly mistake.
Quote:Original post by Emmanuel Deloget
I praise you, dear AP, to allow me to apologize for this horrible, terrible, deadly mistake.


In the name of Euclid, the Pythagoreans, and Euler, your sines are forgiven you. May Gauss have mercy on your soul!

This topic is closed to new replies.

Advertisement