Jump to content
  • Advertisement

Archived

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

Thurgal

Basic Maths

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

Hi, I''ve been held back from learning D3D or OpenGL for sometime because I don''t know any of the maths which I need to know. We''re about to cover trigonometry in class but I can''t be bothered to wait. Could somebody please point me in the direction of a good site for trigonometry, vector and matrix maths ? I would be very greatful for any help.

Share this post


Link to post
Share on other sites
Advertisement
I don''t know any sites for trig., but it''s pretty easy . I''ll give you a basic run through here though. I''m bored, so this should be pretty long .

Most of trig. is based on ratio''s related to right triangles. A right triangle looks like this (I''m sure you know this, I''m just labeling the sides for later):

Angle a
|\
| \
| \ <- Side C
Side B | \
| \
Angle c |_____\ Angle b
Side A

The three common ratios are cosine, sin, and tangent.
sin(Angle) = (Opposite Side)/(Hypotenuse)
Therefore:
sin(a) = A/C
sin(b) = B/C

cos(Angle) = (Adjacent Side)/(Hypotenuse)
Therefore:
cos(a) = B/C
cos(b) = A/C

tan(Angle) = (Opposite Side)/(Adjacent Side)
Therefore:
tan(a) = A/B
tan(b) = B/A

So, given the following example we could solve for the remaining sides (remember that angles can be in different formats, to use this example you have to have your calculator set to degrees):

a=25º
|\
| \
B=?| \ C=100
| \
| \
|_____\ b=65º
c=90º A=?

sin(a) = A/C
So: sin(a) * C = A
So: sin(25º) * 100 = 42.26
So: A = 42.26

sin(b) = B/C
So: sin(b) = B/C
so: sin(b) * C = B
So: sin(65º) * 100 = 90.63
So: B = 90.63

There are also a couple varieties that reverse the order, from length to angle instead of angle to length. They are arc cosine, arc sin, and arc tangent. So:
arcsin(A/C) = a
arcsin(B/C) = b

arccos(B/C) = a
arccos(A/C) = b

arctan(A/B) = a
arctan(B/A) = b

Then there are also some "1 divided by" forms, cosecant, secant, and cotangent:
csc(a) = sin(a)-1 = 1/sin(a) = A/C
sec(a) = cos(a)-1 = 1/cos(a) = B/C
cot(a) = tan(a)-1 = 1/tan(a) = A/B

There are some situation where you won''t have a right triangle, and won''t be able to make one, so you have to use a couple of ''special varieties'' that work anyway.

The law of sines:

sin(a) sin(b) sin(c)
------ = ------ = ------
A B C


The law of cosines (don''t expect to memorize this one immediately, heh):

A2 = B2 + C2 - 2*B*C*cos(a)

You can assign A, B, and C to any sides, as long as you assign ALL of the A''s to the same side, all B''s to the same side, and all C''s to the same side. The angle ''a'' must be the angle that''s across from side A.

Here''s a 3D Math Thingy:
http://www.gamedev.net/reference/articles/article415.asp

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
Here is a helpful link on vector math.

Cyber Intelligence

click on "Tutorial" then "Mathematics".


-----------------------------
"There are ones that say they can and there are those who actually do."

"...u can not learn programming in a class, you have to learn it on your own."

Share this post


Link to post
Share on other sites

  • 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!