
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

The sum of 2 vectors completes the triangle.
also a = c − b and b = c − a
Used to represent a direction or normal. Length of 1.
Aˆ = A~ || A~|| Where || A~|| is the length or magnitude of A~.
Can be used to get the angle between 2 vectors. A^ ~ · B~ =
i=1 AiBi^ =^ A^1 B^1 +^ A^2 B^2 +^ · · ·^ +^ AnBn The dot product returns a single scalar value. θ = arccos( Aˆ · Bˆ)
θ = arccos( A~· B~ || A~|||| B~|| ) Where arccos is inverse cosine cos−^1.
Produces a vector perpendicular to the plane containing the 2 vectors.
a 1 a 2 a 3
b 1 b 2 b 3
a 2 b 3 − a 3 b 2 a 3 b 1 − a 1 b 3 a 1 b 2 − a 2 b 1
To compute surface normals from 2 edges: N = normalize (cross (A, B));
All 0, except the top-left to bottom-right diagonal.
if AB = I then A is the inverse of B and vice versa.
a b c d e f g h i
x y z
ax + by + cz dx + ey + f z gx + hy + iz
n i=1 A(row,^ 1)^ ∗^ B(1, col) +^ · · ·^ +^ A(row, n)^ ∗^ B(n, col) Where n is dimensionality of matrix.
AB =
a b c d
e f g h
ae + bg af + bh ce + dg cf + dh
(rows of A with columns of B)
For a 2x2 or 3x3 matrix use the Rule of Sarrus; add products of top-left to bottom-right diagonals, subtract products of opposite diagonals.
a b c d e f g h i
Its determinant |M | is:
|M | = aei + bf g + cdh − ceg − bdi − af h For 4x4 use Laplace Expansion; each top-row value * the 3x3 matrix made of all other rows and columns: |M | = aM 1 − bM 2 + cM 3 − dM 4 See http://www.euclideanspace.com/maths/algebra/matrix/ functions/determinant/fourD/index.htm
Flip matrix over its main diagonal. In special case of orthonormal xyz matrix then inverse is the transpose. Can use to switch between row-major and column-major matrices.
a b c d e f g h i
a d g b e h c f i
Use an inverse matrix to reverse its transformation, or to transform relative to another object. M M −^1 = I Where I is the identity matrix. If the determinant of a matrix is 0, then there is no inverse. The inverse can be found by multiplying the determinant with a large matrix of cofactors. For the long formula see http://www.cg.info.hiroshima-cu.ac.jp/~miyazaki/ knowledge/teche23.html Use the transpose of an inverse model matrix to transform normals: n′^ = n(M −^1 )T
Commonly used in Direct3D maths libraries
v′^ =
Vx Vy Vz 1
Xx Xy Xz 0 Yx Yy Yz 0 Zx Zy Zz 0 Tx Ty Tz 1
Commonly used in OpenGL maths libraries
v′^ =
Xx Yx Zx Tx Xy Yy Zy Ty Xz Yz Zz Tz 0 0 0 1
Vx Vy Vz 1
column order T =
1 0 0 Tx 0 1 0 Ty 0 0 1 Tz 0 0 0 1
Sx 0 0 0 0 Sy 0 0 0 0 Sz 0 0 0 0 1
Rx =
0 cos(θ) −sin(θ) 0 0 sin(θ) cos(θ) 0 0 0 0 1
Ry =
cos(θ) 0 sin(θ) 0 0 1 0 0 −sin(θ) 0 cos(θ) 0 0 0 0 1
Rz =
cos(θ) −sin(θ) 0 0 sin(θ) cos(θ) 0 0 0 0 1 0 0 0 0 1
Rx Ry Rz −Px Ux Uy Uz −Py −Fx −Fy −Fz −Pz 0 0 0 1
Where U is a vector pointing up, F forward, and P is world position of camera.
Bird’s-eye view V =
Sx 0 0 0 0 Sy 0 0 0 0 Sz Pz 0 0 − 1 0
Sx = (2 ∗ near)/(range ∗ aspect + range ∗ aspect) Sy = near/range Sz = −(f ar + near)/(f ar − near) Pz = −(2 ∗ f ar ∗ near)/(f ar − near) range = tan(f ov/2) ∗ near
revision 4. 5 Oct 2012 Dr Anton Gerdelan, [email protected], Trinity College Dublin, Ireland. LATEX template from http://www.stdout.org/∼winston/latex/ Thanks Micha¨el, Amoss, and Veronica!