Jump to content
  • Advertisement
Sign in to follow this  
Jacob Roman

Cosine

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

I'm trying to understand how cosine works. In all the books I've read, they say it's the adjacent side divided by the hypotenuse: Cos Ө = adjacent side ------------- hypotenuse But lets say the opposite side of a triangle is 3, the adjacent side is 4. Doing the pythagorean theorum: C = Sqr(3² + 4²) = 5 3, 4, and 5. Simple enough. Now when dividing the adjacent side (4) by the hypotenuse (5): Cos Ө = .8 Now what is .8 suppose to represent, an angle of the triangle? Is it an angle in radians, or degrees, or what? Can someone help me understand this. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
The .8 is the ratio between the lengths of the sides of the triangle. If the triangle was a different size but the angles were the same, this ratio would also stay the same (for example, a 6 8 10 triangle).

The angle fully determines the ratio between lengths of the sides. The cosine function is a function from the angle to this ratio.

Share this post


Link to post
Share on other sites
Ok I'm now thinking it was .8 radians, cause I was playing around with the values, and got 36.8698966198457 degrees converted to radians, which gave me .8. Was this right?

Cos(36.8698966198457 * PI / 180) = .8

Share this post


Link to post
Share on other sites
The result of cos is not an angle. It is not in radians. It is just the x-value of the coordinate on the unit circle at the angle you give it.

Share this post


Link to post
Share on other sites
Oh I didn't know that. The book says Cos Ө = .8, so I assumed that it was the angle that it returned. So how would you retrieve the angle from this ratio between the length of the sides?

Share this post


Link to post
Share on other sites
Quote:
Original post by Jacob Roman
Oh I didn't know that. The book says Cos Ө = .8, so I assumed that it was the angle that it returned. So how would you retrieve the angle from this ratio between the length of the sides?


By using the inverse of the functions, cos-1, sin-1, and tan-1 which translate to in C++, asin, acos, atan. Note that the resulting angle is returned in radians, so you need to convert it to degrees. More info here.

Share this post


Link to post
Share on other sites
To find the angle, theta, you need to rearrange cos(theta) = 4/5, to find theta. So, theta = arccos(4/5).

Is this clear enough?

Share this post


Link to post
Share on other sites
To find the angle using asin,acos or atan (Inverse of sin,cos and tan) you first need to picture the triangle shown in the figure by Ra.The angle will be equal to the sin inverse(asin) of opposite side/hypotenuse OR cos inverse(acos) of adjacent side/hypotenuse OR tan inverse(atan) of opposite side/adjacent side.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!