Jump to content
  • Advertisement
Sign in to follow this  
circassia

acos vs cos

This topic is 2705 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

Hi @ all,

i would like to know what the acos function really does, i did some research, but couldn't find detailled information. Why is acos used and not cos for calculating the angle between two Points

thank you very much

Share this post


Link to post
Share on other sites
Advertisement
acos (mathematicaly normally written as cos^-1 x with the -1 as superscript) is the inverse map for cos. acos is a multivalued function technically, y = acos(x) has infinite solutions for y, but we normally take the principal branch restricting it's solutions to the range -pi to pi. therefore for angles 'x' (radians) in the range -pi to pi. acos(cos(x)) = x, and for values 'y' in the range -1 to 1. cos(acos(y)) = y.

the angle between two vectors (not points) can be easily found by the inner product <x,y> = |x||y|cos(t), rearranging to give t = acos(<x,y>/(|x||y|))

the choice of the branch cut for acos means that the value 't' found above for the angle between two vectors is the smallest such angle, it's easy to see that equally t + 2*n*pi for integer n are also solutions to the original equation <x,y> = |x||y|cos(t)

Share this post


Link to post
Share on other sites
Hi Luca,

thank you for your reply, i need now time to look at it, if i have for all that questions, i will be back here ;)

again, thank you for the detailed explanation.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!