geometric transforms 1 linear algebra review 2 matrices matrix - - PowerPoint PPT Presentation

geometric transforms
SMART_READER_LITE
LIVE PREVIEW

geometric transforms 1 linear algebra review 2 matrices matrix - - PowerPoint PPT Presentation

geometric transforms 1 linear algebra review 2 matrices matrix and vector notation use column for vectors m 11 m 12 M = [ ] = [ m ij ] m 21 m 22 T v 1 v = [ ] = v 1 v 2 [ ] v 2 3 matrix operations addition T = M + N t ij ] = [ m ij + n


slide-1
SLIDE 1

geometric transforms

1

slide-2
SLIDE 2

linear algebra review

2

slide-3
SLIDE 3

matrices

matrix and vector notation use column for vectors

M = [ ] = [ ] m11 m21 m12 m22 mij v = [ ] = v1 v2 [ ] v1 v2

T

3

slide-4
SLIDE 4

matrix operations

addition scalar multiplication

T = M + N [ ] = [ ] tij + mij nij T = aM [ ] = [ ] tij amij

4

slide-5
SLIDE 5

matrix operations

matrix-matrix multiplication row-column multiplication not commutative associative

T = MN = [ ] = [ ] tij ∑

k

miknkj = ⎡ ⎣ ⎢ ⎢ t11 t21 t12 t22 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ m11 m21 m12 m22 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ n11 n21 n12 n22 ⎤ ⎦ ⎥ ⎥

5

slide-6
SLIDE 6

matrix operations

matrix-vector multiplication row-column multiplication

u = Mv = ⎡ ⎣ ⎢ ⎢ u1 u2 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ m11 m21 m12 m22 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ v1 v2 ⎤ ⎦ ⎥ ⎥

6

slide-7
SLIDE 7

matrix operations

transpose: flip along diagonal inverse (not computed explicitly in this course)

T = MT [ ] = [ ] tij tji T = M−1 MT = M = M = I M−1 M−1

7

slide-8
SLIDE 8

special matrices

identity: invariant for multiplication

I = [ ] = { iij 1 i = j i ¡ j I = [ ] 1 1 :M : M = MI = IM

8

slide-9
SLIDE 9

special matrices

zero: invariant for addition

O = [ ] = 0 iij I = [ ] :M : M = M + O = O + M

9

slide-10
SLIDE 10

matrix operation properties

linearity of multiplication and addition associativity of multiplication

a(A + B) = aA + aB M(aA + bB) = aMA + bMB A(BC) = (AB)C

10

slide-11
SLIDE 11

matrix operation properties

transpose and inverse of multiplication

(AB = )T BTAT (AB = )−1 B−1A−1

11

slide-12
SLIDE 12

2d transformation

12

slide-13
SLIDE 13

geometric transformations

functions that maps points to points different transformations have restrictions on the form of

p Ü = X(p) p′ X

13

slide-14
SLIDE 14

translation

(p) = p + t Tt (p) = (p) = p − t T −1

t

T−t

14

slide-15
SLIDE 15

linear transformations

fundamental property: can be represented in matrix form: properties: maps origin to origin maps lines to lines parellel lines remain parallel length ratios are preserved closed under composition

X(ap + bq) = aX(p) + bX(q) X(p) = Mp

15

slide-16
SLIDE 16

uniform scale

p = [ ][ ] = [ ] Ss s s px py spx spy = S−1

s

S1/s

16

slide-17
SLIDE 17

non-uniform scale

p = [ ][ ] = [ ] Ss sx sy px py sxpx sypy = S−1

s

S1/s

17

slide-18
SLIDE 18

rotation

p = [ ][ ] = [ ] R? cos ? sin ? − sin ? cos ? px py cos ? − sin ? px py sin ? + cos ? px py = R−1

?

R−?

18

slide-19
SLIDE 19

shear

S p = [ ][ ] = [ ] hs 1 sy sx 1 px py + px sxpy + sypx py

19

slide-20
SLIDE 20

reflection

R p = [ ][ ] = [ ] R p = ) lx −1 1 px py −px py ly R p = [ ][ ] = [ ] lo −1 −1 px py −px −py

20

slide-21
SLIDE 21

affine transforms

combine translation with linear transformation rigid body transformation are a subset of this properties does not map origin to origin maps lines to lines parallel lines remain parallel length ratios are preserved closed under composition

(p) = Mp + t XM,t

21

slide-22
SLIDE 22

transforming points and vectors

points and vectors are different entities vectors: encode direction and length (difference of points) points: encode position (origin plus a vector) points: transform as reported above vectors: transform like points, but no translation is applied directions (normalized vectors): normalize after transform

X(p) = Mp + t X(v) = Mv X( ) = M /| M | d ^ d ^ d ^

22

slide-23
SLIDE 23

transforming points and vectors

proof that vectors transform as such

v X(p) X(v) = p − q = Mp + t = X(p) − X(q) = = (Mp + t) − (Mq + t) = = M(p − q) = = Mv

23

slide-24
SLIDE 24

homogeneous coordinates

represent points/vectors with an additional coordinate set it to 1 for points (or multiply all per arbitrary ) set it to 0 for vectors

w w p = ¢ ⎡ ⎣ ⎢ ⎢ px py 1 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ wpx wpy w ⎤ ⎦ ⎥ ⎥ v = ⎡ ⎣ ⎢ ⎢ vx vy ⎤ ⎦ ⎥ ⎥

24

slide-25
SLIDE 25

homogeneous coordinates

translation: represent as 3x3 matrix shorthand notation for points and vectors

p = = Tt ⎡ ⎣ ⎢ ⎢ 1 1 tx ty 1 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ px py 1 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ + px tx + py ty 1 ⎤ ⎦ ⎥ ⎥ p = [ ][ ] = [ ] Tt I t 1 p 1 p + t 1 v = [ ][ ] = [ ] Tt I t 1 v v

25

slide-26
SLIDE 26

homogeneous coordinates

linear transform: 3x3 matrix by adding one row,column shorthand notation for points and vectors

Mp = = ⎡ ⎣ ⎢ ⎢ m11 m21 m12 m22 1 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ px py 1 ⎤ ⎦ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ + m11px m12py + m21px m22py 1 ⎤ ⎦ ⎥ ⎥ Mp = [ ][ ] = [ ] M 1 p 1 Mp 1 Mv = [ ][ ] = [ ] M 1 v Mv

26

slide-27
SLIDE 27

affine transformations

combine linear and translation in one matrix

Xp = [ ][ ] = Mp + t M t 1 p 1 Xv = [ ][ ] = Mv M t 1 v

27

slide-28
SLIDE 28

combining transforms

apply one transformation after the another express by function composition for affine transformations, compute by matrix multiplication

= ( (p)) = ( Q (p)) p′ X2 X1 X2 X1 ( Q (p)) = ( (p)) = ( )p = ( )p X2 X1 X2 X1 M2 M1 M2M1

28

slide-29
SLIDE 29

combining transforms

translation linear transformations

[ ][ ] = [ ] I t2 1 I t1 1 I + t1 t2 1 [ ][ ] = [ ] M2 1 M1 1 M2M1 1

29

slide-30
SLIDE 30

combining transforms

affine transformations

[ ][ ] = [ ] M2 t2 1 M1 t1 1 M2M1 + M2t1 t2 1

30

slide-31
SLIDE 31

composition is not commutative

  • riginal

rotation translation

  • riginal

transation rotation

31

slide-32
SLIDE 32

complex transformations

represent as combination of simpler ones intuitive geometric interpretation rotation around arbitrary axis at of angle translate axis center to origin rotate (about origin) translate back

a ? = Ra,? TaR?T−a

32

slide-33
SLIDE 33

complex transformations

33

slide-34
SLIDE 34

complex transformations

34

slide-35
SLIDE 35

transforms and coordinate systems

change of coordinate system can be written as affine matrix for , we have that in matrix form becomes

Ü f f ′ p = + + + f ′

O

p′

xf ′ x

p′

xf ′ y

p′

xf ′ z

p = [ ][ ] = [ ][ ] M t 1 p′ 1 f ′

x

f ′

y

f ′

z

f ′

  • 1

p′ 1

35

slide-36
SLIDE 36

transforms and coordinate systems

for , we invert the previous equation since is orthonormal,

f Ü f ′ = [ ][ ] p′ M−1 t M −1 1 p 1 M = M −1 MT = p′ ⎡ ⎣ ⎢ ⎢ ⎢ ⎢ x′T y′T z′T ˝ t x′ ˝ t y′ ˝ t z′ 1 ⎤ ⎦ ⎥ ⎥ ⎥ ⎥ ⎡ ⎣ ⎢ ⎢ ⎢ ⎢ px py pz 1 ⎤ ⎦ ⎥ ⎥ ⎥ ⎥

36

slide-37
SLIDE 37

3d transformations

37

slide-38
SLIDE 38

3d transformations

adopt homogeneous formulation in 3d point have 4 coordinates use 4x4 matrices for transformations most concepts generalize very easily rotation much more complex

38

slide-39
SLIDE 39

translation

= Tt ⎡ ⎣ ⎢ ⎢ ⎢ ⎢ 1 1 1 tx ty tz 1 ⎤ ⎦ ⎥ ⎥ ⎥ ⎥

39

slide-40
SLIDE 40

scale

= Ss ⎡ ⎣ ⎢ ⎢ ⎢ ⎢ sx sy sz 1 ⎤ ⎦ ⎥ ⎥ ⎥ ⎥

40

slide-41
SLIDE 41

rotation around z

= Rz

?

⎡ ⎣ ⎢ ⎢ ⎢ cos ? sin ? −sin ? cos ? 1 1 ⎤ ⎦ ⎥ ⎥ ⎥

41

slide-42
SLIDE 42

rotation around y

= Ry

?

⎡ ⎣ ⎢ ⎢ ⎢ cos ? −sin ? 1 sin ? cos ? 1 ⎤ ⎦ ⎥ ⎥ ⎥

42

slide-43
SLIDE 43

rotation around x

= Rx

?

⎡ ⎣ ⎢ ⎢ ⎢ 1 cos ? sin ? −sin ? cos ? 1 ⎤ ⎦ ⎥ ⎥ ⎥

43

slide-44
SLIDE 44

rotation around arbitrary axis

in 2D, rotation are around a point: change coordinate frame (translation) rotation around the origin change coordinate frame back simple geometric construction in 3D, rotation are around an axis: change coordinate frame (align with axis ) rotation around change coordinate frame back complex geometric construction

= Ra,? TaR?T−a = Ra,? F−1aR?Fa z a z

44

slide-45
SLIDE 45

representing rotations

Euler angles: 3 rotations around major axis remember to choose order simple but has quirks when combining rotations will use this for simplicity axis and angle combinations of rotations can be represented this way with more formalism become elegant and consistent quaternions

45

slide-46
SLIDE 46

transforming normals

points and vectors works tangents, i.e. differences of points, work too normals works differently defined as orthogonal to the transformed surface i.e. orthogonal to all tangents

46

slide-47
SLIDE 47

transforming normals

by definition: after tranform: for all we have: which gives: normals are transformed by the inverse transpose

t ˝ n = n = 0 tT (Mt (Xn) = 0 )T t Xn = 0 tTM T ( n = 0 tTM T MT)−1

47

slide-48
SLIDE 48

transformation hierarchies

48

slide-49
SLIDE 49

transformation hierarchies

  • ften need to transform an object wrt another

e.g. the computer on the table when the table moves, the computer moves naturally build a hierarchy of transformation to transform the table, apply its transform to transform the computer, apply the table and the computer transform

49

slide-50
SLIDE 50

transformation hierarchies

represented as a tree data structure transformation nodes

  • bject nodes / leaves

walk the tree when drawing very convenient representation for objects all objects can be defined in their simplest form e.g. every sphere can be represented by a transformation applied to the unit sphere

50

slide-51
SLIDE 51

transformation hierarchies

51

slide-52
SLIDE 52

implementing transform hierarchies

transformation function for each node get the parent matrix multiply the parent and current matrices pass the combined matrix when calling children stack of transforms push/pop when walking down/up used by graphics libraries (OpenGL) more flexible generalized mechanism for all attributes

52

slide-53
SLIDE 53

raytracing and transformations

transform the object simple for triangles, since they transforms to triangles but most objects require complex intersection tests spheres do not transforms to spheres, but ellipsoids transform the ray much more elegant works on any surface allow for much simpler intersection tests

  • nly worry about unit sphere, all others are transformed

53

slide-54
SLIDE 54

raytracing and transformations

transforming rays transform origin/direction as point/vector note that direction is not normalized now i.e. ray parameter is not the distance intersect a transformed object transform the ray by matrix inverse intersect surface transform hit point and normal by matrix works like changes in coodinate system

54