Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates I Matrix transformations I Reflection and refraction I Curved surfaces
Maths for computer graphics
Computer graphics involves lots of maths
I 2D and 3D coordinatesI Matrix transformationsI Reflection and refractionI Curved surfaces
Vector spaces
Laws
a + b = b + a(a + b) + c = a + (b + c)
⁄(a + b) = ⁄a + ⁄b(⁄µ)a = ⁄(µa)a + 0 = a
’a÷b : a + b = 0
1a = a
E.g. two dimensions
u =
Axy
B
ÎuÎ =Ò
x2 + y2
N dimensions
v =
Q
cax1...
xN
R
db
ÎvÎ =Ò
x21 + x2
2 + . . . + x2N
Subspaces
Linea = ⁄u
ua
Planea = ⁄u + µv
u
v
a
3D spacea = ⁄u + µv + ‹w
Linear dependence
u
v
a
Two vectors are linearlydependent if:
I –a + —b = 0
for some – and — not both zero.More generally for n vectors:
I –a + —b + . . . + ‹n = 0
Dot product
u · v =
Q
cau1...
un
R
db ·
Q
cav1...
vn
R
db = u1v1 + u2v2 + · · · + un
vn
vu
w
ÎwÎ = u · v
u · v = ÎuÎÎvÎ cos ◊
u · v = v · uu · (⁄v + µw) = ⁄(u · v) + µ(u · w)
Coordinate systems
In an N dimensional vector space V , a set of N linearlyindependent vectors forms a basis. For some vector u œ V :u = –e1 + —e2 + . . . + ‹e
N
A basis e1, . . . , eN
is orthogonal if for all ei
, ej
, i ”= j :e
i
· ej
= 0A basis e1, . . . , e
N
is orthonormal if it is orthogonal and for all ei
:Îe
i
Î = 1
Cross product
Îu ◊ vÎ = ÎuÎÎvÎ sin ◊
Q
caabc
R
db ◊
Q
caxyz
R
db =
Q
cabz ≠ cycx ≠ azay ≠ bx
R
db
v ◊ u = ≠u ◊ v ”= u ◊ v u
v
u×v
Matrix algebra
A =
Q
cccca
a11 a12 . . . a1n
a21 . . . . . . a2n
...a
m1 am2 . . . a
mn
R
ddddb
A(BC) = (AB)CAB ”= BA
(A + B)C = AC + BCAI = IA = A
(AB)T = BT AT
A≠1A = I
References
Reading
I Shirley, Chapter 2.4 (Miscellaneous Math – Vectors)I Foley, Appendix A.1-A.5 (Maths for Computer Graphics)