Mathematics fundamentals

Post on 29-Jun-2015

101 views 0 download

Tags:

description

Mathematics Fundamental related with Graphics

transcript

Mathematics Fundamentals

Matrix

Matrix

• A matrix is a collection of numbers arranged into fixed number of rows and columns

• C R

• Each number that makes up a matrix is called an element of the matrix.

• The element in a matrix have specific location

• The numbers of rows and columns of a matrix are called its dimensions

• Here it is 4x3

• 2x3

Squire matrix

• A matrix with the number of rows==columns• In CG squire matrices are used for

transformation

Row matrix

• column Matrix

Notation

• Usually a capital letter in bold face like • A or M• Sometimes as a reminder the dimensions are

written to the right of • the letter as in B3x3

Location of elements

• If 2 matrices contain the same No. as elements; are the 2 matrices equal to each other???

• If 2 matrices contain the same No. as elements; are the 2 matrices equal to each other???

• No, to be equal, must have the same dimensions and must have the same values in the same positions.

• In other words, say that An x m = [ai j] and that Bp x q = [bi j]

• Then A = B if and only if n=p, m=q, and ai j =bi j for all I and j in range

Zero matrix

• Which has all its elements zero •

Adding

• The sum A+B of two m-by-n matrices A and B is calculated entry wise:

• (A + B)i,j = Ai,j + Bi,j, where 1 ≤ i≤ m and 1 ≤ j ≤ n.

• Do you think that • (A + B) +C = A + (B + C)

• Do you think that • (A + B) +C = A + (B + C)• Yes

Scalar multiplication

• The scalar multiplication cA of a matrix A and a number c (also called a scalar in the parlance of abstract algebra) is given by multiplying every entry of A by c:(cA)i,j = c · Ai,j.

Transpose

• The transpose of an m-by-n matrix A is the n-by-m matrix AT (also denoted Atr or tA) formed by turning rows into columns and vice versa:(AT)i,j = Aj,i.

• Familiar properties of numbers extend to these operations of matrices

• for example, addition is commutative, i.e., the matrix sum does not depend on the order of the summands: A + B = B + A.

• The transpose is compatible with addition and scalar multiplication, as expressed by (cA)T = c(AT) and

• (A + B)T = AT + BT. • Finally, (AT)T = A.

• The identity matrix In of size n is the n-by-n matrix in which all the elements on the main diagonal are equal to 1 and all other elements are equal to 0, e.g.

• It is called identity matrix because multiplication with it leaves a matrix unchanged: MIn = ImM = M for any m-by-n matrix M.

Vector • Row matrix

• column Matrix

Vector

• Magnitude and the direction of two connecting points in coordinate system is V

• If P1 = (x1, y1,z1) is Is the starting point and P2=(x2,y2,z2) is the ending point, then the vectorV = (x2-x1, y2-y1, z2-z2)

Projection in 2D

• Projection of v onto the x-axis

Projection in 3D

• Projection of v onto the xz plan

• The magnitude (length) of a vector :

Derived from the Pythagorean theorem

– The direction of the vector:

α is angular displacment from the x-axis

α

3D

• The magnitude is simple extension of 2D

• Direction:• Needs 2 angles to fully describe directions • Latitude/longitude is a real word example

• α, β, y are the positive angles that the vector makes with each of the positive cordinate axes x,y and z respectivly

Normalizing

• Shrinking or stretching it so its magnitude is 1– Creating unit vector– Does not change the direction

• Normalize by dividing on its magnitude:

• It doesn’t come out to exactly 1, this is bcz of the error using only 2 decimal places