Archived

This topic is now archived and is closed to further replies.

Luke1

Can SomeOne Explain Cos/Sin ?

Recommended Posts

Im a noob when it comes to math and i see cos/sin alot in game programming i was wondering what they are. I know its something to do with angles but thats all i know.

Share this post


Link to post
Share on other sites
You are younger than 15 I guess? Anyway to explain that kind of stuff is better learned at school... ask your math teachers and if you don't want to do it .... I am looking for a webpage that explains it now... I'll edit this if I find any.
----------------------------------------------
found this place:
http://math.about.com/gi/dynamic/offsite.htm?site=http%3A%2F%2Fwww.horacemann.org%2Facademics%2Fmath%2Fpcbch%2Ftrig%2Fsohcahtoa.html
but from what I see you better ask in school.

[edited by - Coz on March 6, 2003 2:09:25 PM]

Share this post


Link to post
Share on other sites
I''ll second that, also (if you can) go down to your local library, they might have good introductory books or go to your school library or even math teachers and ask to borrow some books.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Picture a right triangle - that is a triangle with one 90-degree angle. The longest side (the hypotenuse) is the side opposite the 90-degree angle. If you pick one of the other angles, it has an adjacent side (the other side of the angle besides the hypotenuse) and an opposite side. If you know the length of the sides...

sin(angle) = opposite/hypotenuse
cos(angle) = adjacent/hypotenuse
tan(angle) = opposite/adjacent = sin(angle)/cos(angle)

So how is this useful? Well, think of the length of the hypotenuse as the velocity, say 10 m/s, of a projectile fired at some angle. If you are looking at this from a side view, it would be useful to know the X and Y positions of the projectile at any time t. They are given by:

X = t * 10 * cos(angle)
Y = t * 10 * sin(angle)

Of course, this is assuming no gravity. Just for S&G let''s add that in. Acceleration due to gravity is approximately -9.8 m/s^2 (that''s 9.8 meters per second, per second downward). We refine our Y-coordinate equation as follows:

Y = 0.5 * -9.8 * t^2 + t * 10 * sin(angle)

You''re probably wondering about the 0.5... well that gets into calculus and if you don''t know trigonometry yet I''m not even going to try to explain that! Just trust me, it goes there.

So, that''s just one application of sin and cos. There are many more. Study math HARD, it comes in very very handy later on!!

(I should probably get an account so I don''t have to post annonymously all the time huh?)

Share this post


Link to post
Share on other sites
Trigonometry was formed by thinking of triangles in the way that AP mentioned, but there are so many applications of trigonometry now that it is indispensible. Study trigonometry carefully, memorize some trig identities, prove a bunch of them, and visualize the concept. You'll thank yourself for it when you're cruising through calculus, physics, and other "difficult-sounding" mathematical subjects while your peers are still struggling to remember that sin^2(x) + cos^2(x) = 1.

I don't know trigonometry well enough myself and I am now in the process of kicking myself in the ass and otherwise pitying myself for not paying more attention to it.

This isn't life in the fast lane, it's life in the oncoming traffic.
-- Terry Pratchett

[edited by - Kentaro on March 6, 2003 2:38:21 PM]

Share this post


Link to post
Share on other sites
I highly recommend getting with a math teacher and having them go over this with you, but here it is in a nutshell...

I assume you know something about cortisian coordinates

cos (cosine) and sin (sine) are trigonometry functions based on a unit circle (a circle with a radius of 1). The cosine function returns the x value of a point on the circle at that particular angle, and the sine function returns the y value of a point on the circle at that particular angle. Because you draw the unit circle starting at point (1,0) the angle for that point is 0 (radians), the cosine at that point (cos(0)) equals 1 (the x value) and the sine at that point (sin(0)) equals 0 (the y value). The circle is drawn counter-clockwise as the radians (or degrees) increase so when the angle is pi/2 (90 degrees) the cosine=0 and the sine=1.

The sin and cos functions are very useful for rotating points. to rotate a point in 2D use the equations:
x=distance from origin*cos(angle)
y=distance from origin*sin(angle)


hope this helps.

Share this post


Link to post
Share on other sites