Archived

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

Degree's, cos, blah!

Recommended Posts

UponTheEnd    122
In alot of programs i have seen cos and sin and tan used alot and alot of stuff with degree''s. i am a very visual learner and i was what are some ways to invision how degree''s are workingwith objects and view and all that in opengl. Is it for each deminsion, there are 360 degree''s and cos and sin and tan repeasant 3 deminsions with 360 degree''s each and to say someone is looking in this direction, you would use 3 numbers for each deminsion to give a interpretation of the view? I am lost in this area. once i have a way to invision it i will be fine and i can move on to things like what on earth do cos and sin and tan do for programming. Well thanks

Share on other sites
Kihaji    122
sin cos tan.

Think of Soh Cah Toa

sin = opposite of the hypotenuse
cos = adjacent over the hypotenuse
tan = opposite of the adjacent

Now think of a triangle room where you are at one point looking at the right angle.

sin = opposite wall over the roof
cos = floor over the roof
tan = opposite wall over the floor

Now think of translations of a point, you are at the origin looking out down the X axis, and a point moves from a spot on the x axis straight up

sin = height of the point over straight line distance to it
cos = x value of the point over straight line distance to it
tan = height of the point over x value of the point.

That help?

Share on other sites
UponTheEnd    122
I followed everything up until the end where you began saying "straight line distance to it"

What did you mean by that?

Share on other sites
Kihaji    122
Draw a line from the origin to the point. The length of that line is straight line distance, as opposed to the lenght from the origin to its X value.

Share on other sites
Nemesis2k2    1045
Ok, I''ll try and sum up the basics for you, but you really should get a textbook or otherwise on trigonometry, because it is a very long and complex topic. I should also note that the way I am about to describe these values to is not the "traditional" method they teach you at school. This is the result of my own experimentation with the subject, after my math teachers totally failed to give me any useful explination. IMO it is much much simpler to understand than what they try and tell you at school.

First of all, visualise a toothpick that is 5 centimetres long. Now imagine that we have placed this toothpick on a piece of gridpaper, with one end of it at the bottom left corner of the paper, and the other end pointing towards the opposite corner at the top right of the page. The bottom line of the grid we will call the x-axis, and the leftmost vertical line we will call the y-axis. There is an angle between the x-axis and the toothpick, which we will call theta.

Sin and cos are operations that return a number when passed an angle, in this case, theta. This number is never less than -1, and never greater than 1. This number is essentially a ratio.
The sin of theta will return a ratio, that when multiplied by the length of the toothpick, will return the total number of centimitres that the toothpick stretches along the y-axis.
The cos of theta will return a ratio, that when multiplied by the length of the toothpick, will return the total number of centimitres that the toothpick stretches along the x-axis.

To put it another way, and give it an application, sin and cos can be used to derive the x and y coordinates of a line with a given length, and its angle between an axis and the hypotenuse (the hypotenuse is, in this case, effectively the line the toothpick makes).

This is how the basic use of sin and cos relates to 3D programming, and what they essentially are. The topic is much much more complicated though, and I could write a book just on how they relate to each other. I can guarantee you that you will not even come close to fully understanding this without a lot of research. There is no way to sum it up in one post on a forum.