Jump to content
  • Advertisement
Sign in to follow this  
judge dreadz

maths - sin between vectors

This topic is 4452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.B
sin(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,

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest 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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!