What are sine, cosine, and tangent? Constants? Functions?
...And how are they useful?
The only use for them I know is the:
angle degree = -tan(o/a)
Other than that, I know pretty much nothing about the 3. =\
What are sine, cosine, and tangent? Constants? Functions?
...And how are they useful?
The only use for them I know is the:
angle degree = -tan(o/a)
Other than that, I know pretty much nothing about the 3. =\
Take some trig and learn
In the basic way is that from an Angle:
sine is the ratio of the opposite leg to the hypotenuse
cosine is the ratio of the adjucent leg to the hypotenuse
Tangent is the ratio of the opposite leg to the adjucent leg
Last edited by Thantos; 03-07-2004 at 09:52 PM.
I already knew that too, I just don't know any useful applications for them. =\Originally posted by Thantos
Take some trig and learn
In the basic way is that from an Angle:
sine is the ratio of the opposite leg to the hypotenuse
cosine is the ratio of the adjucent leg to the hypotenuse
Tangent is the ratio of the opposite leg to the adjucent leg
They are used for solving triangles. Honestly you'll need to take Trig to get the full usefullness of them.
the sine, cosine and tangent are basically ratios of the lenghths of two sides of a triangle.
take for example, the scenario where you know an angle of a right triangle and the length of one of the sides, and you need to find out the length of one of the other sides. you would then work out via algebra whether to multiply or divide the result of the sin, cos, or tan ( depending on what side you have / need ) by the length of the side you have
here, where 30 is the measure of that angle, and 5 is the length of the hypotenuse, you could work out the remaining sides as follows:Code:|\ | \ | \ | \ 5 x | \ | \ |___30 \ y
sin( 30 ) * 5 = the length of x
cos( 30 ) * 5 = the length of y
trig is really useful for solving these types of equations. in computer game programming (which i am into more than any other realm of programming) we dont normally use trig where we can avoid it, because trig functions are slow. game programmers spend most of their time with linear algebra and vectors and stuff, but that doesnt mean it isnt still used on occasion.
Last edited by ...; 03-07-2004 at 10:16 PM.
I came up with a cool phrase to put down here, but i forgot it...
oops, disregard... double post
I came up with a cool phrase to put down here, but i forgot it...
Well as ... mentions, they are used for finding sides of triangles. Especially when u get into advanced math sin, cos, and tan are especially useful. Also if ur gonna go into triangles, know some trig identities
In this snippet COS and SIN get the correct component increments for x and y for the given angle.Code:#define PI 3.14159 #define MAX_X 640 #define MIN_X 0 #define MAX_Y 480 #define MIN_Y 0 #define DEGTORAD(x) ((double)x*PI/180.0) struct point2D { double x; double y; }; class Bullet { point2D Screen; point2D Velocity; int Angle; public: Bullet(point2D tScreen,int tAngle); void Move(void); }; Bullet::Bullet(point2D tScreen,int tAngle) { Angle=tAngle; Screen=tScreen; Velocity.x=cos(DEGTORAD(tAngle)); Velocity.y=sin(DEGTORAD(tAngle)); }; void Bullet::Move(void) { Screen.x+=Velocity.x; Screen.y+=Velocity.y; if (Screen.x>=MAX_X) Velocity.x=-Velocity.x; if (Screen.x<=MIN_X) Velocity.x=-Velocity.x; if (Screen.y>=MAX_Y) Velocity.y=-Velocity.y; if (Screen.y<=MIN_Y) Velocity.y=-Velocity.y; }
EDIT: I forgot to place the return type in front of my move() function member.
Last edited by VirtualAce; 03-08-2004 at 05:18 PM.
Google for "Computer Graphics" sin cos tan will all make appearances on those related pages.
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
They also pop up a lot in physics, like finding the horizontal and vertical velocities of a ball kicked at say 30 degrees at 15 k's an hour. That will let you calculate how long the ball will go, how high etc.
I would also expect it to pop up a lot in architecture and any forms of engineering.
As a pleb you'll probably not have any use for it, but if your going for a professional career like engineering or even in IT they might just come in handy. Plus they are fun to learn (IMHO) and the problem solving aspects alone are worth learning.
Functions can be a lot of fun. Lets say you have a graph of say y = 5x + 3.
This could also be written as f(x) (ie, a function of x) = 5x +3
They come up a lot when your finding things like the derivative of a graph, ie. the instantaneous speed of a graph of distance vs time at a given point X.
Constants are just numbers. Pie is a constant, so is 5, 10002, -111000 and 0. Their values never change, so they are constant.
Last edited by nickname_changed; 03-08-2004 at 02:33 AM.
Sines, cosines, and tangents can also be used with circles, I believe, but, hey, I'm starting Adv. Trig in High School next year...
Wow! Bubba posted code without assembler in it!
Do not make direct eye contact with me.
Wow! Bubba posted code without assembler in it!
Yes, it does happen every now and then.
Most of that would be a real mess in assembler and you probably wouldn't gain much for your troubles.
So I beg for forgiveness from the assembly gods because Bubba hath failed thee this time.
yeah, a circle is defined as:Sines, cosines, and tangents can also be used with circles, I believe, but, hey, I'm starting Adv. Trig in High School next year...
X^2 + Y^2 = R^2
where R is the radius of the circle. a unit circle can be defined using trigonometric functions as:
cos^2 x + sin^2 x = 1
I didn't know the eqation for a circle had XOR in itX^2 + Y^2 = R^2