transformations jehee lee seoul national university

33
Transformations Jehee Lee Seoul National University

Upload: millicent-small

Post on 20-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Transformations Jehee Lee Seoul National University

Transformations

Jehee Lee

Seoul National University

Page 2: Transformations Jehee Lee Seoul National University

Transformations

• Linear transformations

• Rigid transformations

• Affine transformations

• Projective transformations

T

Global reference frame

Local moving frame

Page 3: Transformations Jehee Lee Seoul National University

Linear Transformations

• A linear transformation T is a mapping between vector spaces– T maps vectors to vectors– linear combination is invariant under T

• In 3-space, T can be represented by a 3x3 matrix

)()()()( 11000

NN

N

iii TcTcTccT vvvv

major) (Row

major)(Column )(

3331

1333

Nv

vMvT

Page 4: Transformations Jehee Lee Seoul National University

Examples of Linear Transformations

• 2D rotation

• 2D scaling

y

x

y

x

cossin

sincos

y

x

s

s

y

x

y

x

0

0

yx, yx ,

Page 5: Transformations Jehee Lee Seoul National University

Examples of Linear Transformations

• 2D shear– Along X-axis

– Along Y-axis

y

dyx

y

xd

y

x

10

1

dxy

x

y

x

dy

x

1

01

Page 6: Transformations Jehee Lee Seoul National University

Examples of Linear Transformations

• 2D reflection– Along X-axis

– Along Y-axis

y

x

y

x

y

x

10

01

y

x

y

x

y

x

10

01

Page 7: Transformations Jehee Lee Seoul National University

Properties of Linear Transformations

• Any linear transformation between 3D spaces can be represented by a 3x3 matrix

• Any linear transformation between 3D spaces can be represented as a combination of rotation, shear, and scaling

• Rotation can be represented as a combination of scaling and shear– Is this combination unique ?

Page 8: Transformations Jehee Lee Seoul National University

Properties of Linear Transformations

• Rotation can be computed as two-pass shear transformations

Page 9: Transformations Jehee Lee Seoul National University

Changing Bases

• Linear transformations as a change of bases

yx, yx ,

0v

1v1v

0v

y

x

y

x

yxyx

1010

1010

vvvv

vvvv

Page 10: Transformations Jehee Lee Seoul National University

Changing Bases

• Linear transformations as a change of bases

yx, yx ,

0v

1v1v

0v

11001

11000

vvv

vvv

bb

aa

y

xT

y

x

ba

ba

y

x

y

x

ba

ba

y

x

11

00

11

001010 vvvv

Page 11: Transformations Jehee Lee Seoul National University

Affine Transformations

• An affine transformation T is a mapping between affine spaces– T maps vectors to vectors, and points to points– T is a linear transformation on vectors– affine combination is invariant under T

• In 3-space,T can be represented by a 3x3 matrix together with a 3x1 translation vector

)()()()( 11000

NN

N

iii TcTcTccT pppp

131333)( TpMpT

Page 12: Transformations Jehee Lee Seoul National University

Properties of Affine Transformations

• Any affine transformation between 3D spaces can be represented by a 4x4 matrix

• Any affine transformation between 3D spaces can be represented as a combination of a linear transformation followed by translation

110)( 131333 pTMpT

Page 13: Transformations Jehee Lee Seoul National University

Properties of Affine Transformations

• An affine transf. maps lines to lines

• An affine transf. maps parallel lines to parallel lines

• An affine transf. preserves ratios of distance along a line

• An affine transf. does not preserve absolute distances and angles

Page 14: Transformations Jehee Lee Seoul National University

Examples of Affine Transformations

• 2D rotation

• 2D scaling

1100

0cossin

0sincos

1

y

x

y

x

yx, yx ,

1100

00

00

1

y

x

s

s

y

x

y

x

Page 15: Transformations Jehee Lee Seoul National University

Examples of Affine Transformations

• 2D shear

• 2D translation

1100

010

01

1

y

xd

y

x

1100

10

01

1

y

x

t

t

y

x

y

x

Page 16: Transformations Jehee Lee Seoul National University

Examples of Affine Transformations

• 2D transformation for vectors– Translation is simply ignored

0100

10

01

0

y

x

t

t

y

x

y

x

Page 17: Transformations Jehee Lee Seoul National University

Examples of Affine Transformations

• 3D rotation

11000

0cossin0

0sincos0

0001

1

z

y

x

z

y

x

11000

0100

00cossin

00sincos

1

z

y

x

z

y

x

11000

0cos0sin

0010

0sin0cos

1

z

y

x

z

y

x

How can we rotate about an arbitrary line ?

Page 18: Transformations Jehee Lee Seoul National University

Pivot-Point Rotation

• Rotation with respect to a pivot point (x,y)

100

sin)cos1(cossin

sin)cos1(sincos

100

10

01

100

0cossin

0sincos

100

10

01

),()(),(

xy

yx

y

x

y

x

yxTRyxT

Page 19: Transformations Jehee Lee Seoul National University

Fixed-Point Scaling• Scaling with respect to a fixed point (x,y)

100

)1(0

)1(0

100

10

01

100

00

00

100

10

01

),(),(),(

yss

xss

y

x

s

s

y

x

yxTssSyxT

yy

xx

y

x

yx

Page 20: Transformations Jehee Lee Seoul National University

Scaling Direction

• Scaling along an arbitrary axis

)(),()(1 RssSR yx

)(1 R),( yx ssS)(R

Page 21: Transformations Jehee Lee Seoul National University

Composite Transformations

• Composite 2D Translation

),(

),(),(

2121

2211

yyxx

yxyx

tttt

ttttT

T

TT

100

10

01

100

10

01

100

10

01

21

21

1

1

2

2

yy

xx

y

x

y

x

tt

tt

t

t

t

t

Page 22: Transformations Jehee Lee Seoul National University

Composite Transformations

• Composite 2D Scaling

),(

),(),(

2121

2211

yyxx

yxyx

ssss

ssssT

S

SS

100

00

00

100

00

00

100

00

00

21

21

1

1

2

2

yy

xx

y

x

y

x

ss

ss

s

s

s

s

Page 23: Transformations Jehee Lee Seoul National University

Composite Transformations

• Composite 2D Rotation

)(

)()(

12

12

R

RRT

100

0)cos()sin(

0)sin()cos(

100

0cossin

0sincos

100

0cossin

0sincos

1212

1212

11

11

22

22

Page 24: Transformations Jehee Lee Seoul National University

Composing Transformations

• Suppose we want,

• We have to compose two transformations

)90( R )3,(xT

Page 25: Transformations Jehee Lee Seoul National University

Composing Transformations

• Matrix multiplication is not commutative

)3,()90()90()3,( xx TRRT

Translationfollowed by

rotation

Translationfollowed by

rotation

Page 26: Transformations Jehee Lee Seoul National University

Composing Transformations

– R-to-L : interpret operations w.r.t. fixed coordinates

– L-to-R : interpret operations w.r.t local coordinates

pRTp )90()3,( xT

)90( R )3,(xT

)90( R)3,(xT

(Column major convention)

Page 27: Transformations Jehee Lee Seoul National University

Review of Affine Frames

• A frame is defined as a set of vectors {vi | i=1, …, N} and a point o– Set of vectors {vi} are bases of the associate vector

space– o is an origin of the frame– N is the dimension of the affine space– Any point p can be written as

– Any vector v can be written as

NNccc vvvop 2211

NNccc vvvv 2211

Page 28: Transformations Jehee Lee Seoul National University

Changing Frames

• Affine transformations as a change of frame

yx,

0v

1v

111010

1010

y

x

y

x

yxyx

ovvovv

ovvovv

0v1v

o

o

Page 29: Transformations Jehee Lee Seoul National University

Changing Frames

• Affine transformations as a change of frame

ovvo

vvv

vvv

100

11001

11000

cc

bb

aa

11001

11001

111

000

111

000

1010

y

x

cba

cba

y

x

y

x

cba

cba

y

x

ovvovv

yx,

0v

1v0v

1v

o

o

Page 30: Transformations Jehee Lee Seoul National University

Rigid Transformations

• A rigid transformation T is a mapping between affine spaces– T maps vectors to vectors, and points to points– T preserves distances between all points– T preserves cross product for all vectors (to avoid

reflection)

• In 3-spaces, T can be represented as

1det and

where,)( 131333

RIRRRR

TpRpTT

T

Page 31: Transformations Jehee Lee Seoul National University

Rigid Body Transformations

• Rigid body transformations allow only rotation and translation

• Rotation matrices form SO(3)– Special orthogonal group

IRRRR TT

1det R

(Distance preserving)

(No reflection)

Page 32: Transformations Jehee Lee Seoul National University

Summary

• Linear transformations– 3x3 matrix– Rotation + scaling + shear

• Rigid transformations– SO(3) for rotation– 3D vector for translation

• Affine transformation– 3x3 matrix + 3D vector or 4x4 homogenous matrix– Linear transformation + translation

• Projective transformation– 4x4 matrix– Affine transformation + perspective projection

Page 33: Transformations Jehee Lee Seoul National University

Questions

• What is the composition of linear/affine/rigid transformations ?

• What is the linear (or affine) combination of linear (or affine) transformations ?

• What is the linear (or affine) combination of rigid transformations ?