Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer...

9
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

Transcript of Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer...

Page 1: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

Maths for computer graphics

Computer graphics involves lots of maths

I 2D and 3D coordinatesI Matrix transformationsI Reflection and refractionI Curved surfaces

Page 2: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

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

Page 3: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

Subspaces

Linea = ⁄u

ua

Planea = ⁄u + µv

u

v

a

3D spacea = ⁄u + µv + ‹w

Page 4: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

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

Page 5: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

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)

Page 6: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

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

Page 7: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

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

Page 8: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

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

Page 9: Maths for computer graphics - The University of Edinburgh · Maths for computer graphics Computer graphics involves lots of maths I 2D and 3D coordinates ... I Shirley, Chapter 2.4

References

Reading

I Shirley, Chapter 2.4 (Miscellaneous Math – Vectors)I Foley, Appendix A.1-A.5 (Maths for Computer Graphics)