Dark Bit Factory & Gravity
PROGRAMMING => Other languages => Blitz => Topic started by: Roly on May 17, 2006
-
Original post from Phoenix, taken from the ezboard forum
Hello everybody!
Whats the diffrence between Sin() and Cos()? I know how to use Sin(), and I use it often, but I don't know what Cos() does. I use Cos() sometimes, when for example moving a space ship, but I use it without knowing what it does. I looked in the command reference, but I didn't really understand... Can anyone help me?
Thanks in advance!
Phoenix
Try here see if this helps
www.dbfinteractive.com/tutorialindex.htm
To my understanding, Cos() does basically the same thing as Sin(), but with slightly different results.
Where sin(0) = 0, cos(0) = 1.0, and when sin(90) = 1.0 then cos(90) = 0.
So they do sorta the same thing, but with opposite results. Kinda :) .
Hope that helps.
Ahh. Okay, I think I understand. Thanks!
Phoenix
Cos is inverse sine.
-
I dont think cos is the inverse of sin.
Sin = O/H and Cos = A/H
1/sin <> cos = cosecant
-
Doh!
-
In basic Maths, what does that actuall mean?
Cheers and many thanks,
Clyde.
-
For any right angle triangle
where angle=the angle of one of the corners that isn't the right angle
cos(angle)=the ratio between the lengths of the hypotenuse(the longest edge which is always opposite the right angle) and the adjacent edge to your angle
sin(angle)=the ration between the lengths of the hypotenuse and the opposite edge to your angle
the result of sin or cos can never be more that 1.0 (or less than -1.0) because neither the adjacent adge or the opposite edge can be longer than the hypoenuse.
-
Another way to look at it. If you draw a circle that has a radius of 1, then the points that lie on the circle at any angle have x,y coordinates which are the sin and cos of that angle. That's why they're so uselful for rotating things in circles.
Jim
-
I still wait to see a demo claiming "Have you ever seen a cosine scroller before? WORLDS FIRST!!!" =)))
-
Thats a hell of a question. It is such a complex question deep down but on the surface for us programmers.
(In degrees) sin(angle) = cos(angle+90)
(in radians) sin(angle) = cos(angle+PI/2)
In other words you can _always_ use a sin when you were going to use a cos. They have the same shape, input and output range. They are, for our purposes, the same thing. One day Ill get desperate enough to replace all my calls ot cos with calls to sin to save bytes ;-)
-
I guess the real answer to "what's the difference between Sin and Cos?" is just "90degrees" :D
Jim
-
Sin and Cos are useful for rotation in programs... the values for each can be defined by the Unit Circle (see attachment)
all they are are values to find angles of an object...
basically what everyone has stated already!!!! lol!