#### Archived

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

# Basic Maths

This topic is 5936 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
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 CSide 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

Therefore:
cos(a) = B/C
cos(b) = A/C

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 on other sites
Well, after I edited my post it nuked my ASCII art, so I deleted my messages and reposted it. I also wanted to add that the law of sines and law of cosines have their quarks, but they take too long to describe. I''m sure they''re in your trig. book.

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

##### Share on other sites

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."