Jump to content
  • Advertisement
Sign in to follow this  
Samsonite

how does SIN and COSINE work?

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

Hello! can anybody explain how sinus and cosinus (SIN and COS) work? I can't wait to learn it :) [Edited by - Samsonite on June 26, 2005 5:09:04 PM]

Share this post


Link to post
Share on other sites
Advertisement
Do you mean, what do they do as mathematical functions... or how are sines and cosines computed on computer hardware?

Share this post


Link to post
Share on other sites
Mathematically its related to the exponential function in complex (you know "i = sqrt(-1)") space.

Look up eulers "e" function.

where e^(i*theta) generates the unit circle when turned 2pi degrees.

e^(i*theta) - e^(-i*theta)
--------------------------
2i

I believe is the function for sin. Just take the derivitive with respect to theta to get cos.

(http://en.wikipedia.org/wiki/Cosine)

[Edited by - c0dedrag0n on June 24, 2005 1:46:57 PM]

Share this post


Link to post
Share on other sites
Mmm, since your website states you're 14, maybe a more basic explanation is in order. (I don't know how good education is in Norway, though :-) )
Sine and cosine (and tangent too) basically are the ratios of the sides of a triangle:

+
/|
H / | O
/ |
/a |
+----+
A

The angle a is (almost completely) defined by the lengths of the sides. (Imagine moving the upmost point around). The sine of the angle a in this triangle is the length O divided by H. The cosine is A divided by H. The tangent of a is O divided by A.
So, what's the use? Say we know the left-bottom point of the triangle is (0,0) and the upmost point is (3,4). Now we now that A=3 and O=4, giving tan a=4/3. On most calculators you have a button called tan-1 or atan. Using this we can now found the angle that corresponds to our tan a of 4/3. My calculator says the angle is 53 degrees.
Et voila, now you can convert coordinates on screen or in your game world into angles: something you will do quite often.
Of course, as stated above, sine and cosine are used in tons of other calculations. But that's something for another day, I guess.

Share this post


Link to post
Share on other sites
Draw a circle, make the radius equal to 1.
Go ahead, get a piece of paper and actually draw it.
Draw a horizontal line through the center of the circle.
Draw another line from the center of the circle to any point on the circle.

Look at the angle between the two lines. We'll call it "theta".
Now look at the point where the second line touches the circle.
The horizontal distance from the center of the circle to this point is called "cosine theta".
The vertical distance is called "sine theta".

That's the basics. It gets more complicated from there. It turns out that cosine and sine have some really useful practical properties.

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!