2-d transformations

6
Fall 2004 CS-321 Dr. Mark L. Hornick 1 2-D Transformations World Coordinates Local/Modelling Coordinates x y Object descriptions Often defined in model coordinates Must be mapped to world coordinates Groups of objects are combined; complete image is formed by combining primitives

Upload: norah

Post on 06-Jan-2016

34 views

Category:

Documents


0 download

DESCRIPTION

2-D Transformations. Local/Modelling Coordinates. y. Object descriptions Often defined in model coordinates Must be mapped to world coordinates Groups of objects are combined; complete image is formed by combining primitives. x. World Coordinates. 2-D Transformations. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 2-D Transformations

Fall 2004 CS-321Dr. Mark L. Hornick

1

2-D Transformations

World Coordinates

Local/Modelling Coordinates

x

y

Object descriptions Often defined in

model coordinates Must be mapped to

world coordinates Groups of objects are

combined; complete image is formed by combining primitives

Page 2: 2-D Transformations

Fall 2004 CS-321Dr. Mark L. Hornick

2

2-D Transformations

World Coordinates

Local/Modelling Coordinates

x

y

Problem statement: Convert points from

coordinates in one system to a second coordinate system

Page 3: 2-D Transformations

Fall 2004 CS-321Dr. Mark L. Hornick

3

Combining Rotation and Translation

T(,p) can be expressed in terms of submatrices as

The inverse of T(,p) is given by

( , )

0 1

R pT p

x1

y1

v1 v2

y2

x2

p

y*2

x*2

1( , )0 1

t t

R R pT p

1 2v vT

Page 4: 2-D Transformations

Fall 2004 CS-321Dr. Mark L. Hornick

4

Scaling

0 0

0 0

0 0 1

x

y

S

S

S

2

2

1

x

y

x S

y S

1

i

i i

x

v y

1 2v vS

Sx and Sy usually have the same values; thisIs called Uniform Scaling

Scaling affects every coordinate in the shape; e.g. doubling each value when the scale factor=2

Before scaling

After scaling by 2

Page 5: 2-D Transformations

Fall 2004 CS-321Dr. Mark L. Hornick

5

Combining Rotation, Translation and Scaling to convert from coordinates in x2y2 to x1y1

0 0

0 0

0 0 1

x

y

S

S

S

1

i

i i

x

v y

1 2v vTS

cos sin

( , ) sin cos0 1

0 0 1

x

y

pR p

p

T p

Page 6: 2-D Transformations

Fall 2004 CS-321Dr. Mark L. Hornick

6

Inverse transformation: converting from coordinates in x1y1 to x2y2

1 1 12 1 1v v v

TS S T

1

1/ 0 0

0 1/ 0

0 0 1

x

y

S

S

S

1 2v vTS

1( , )0 1

t tR R p

T p

Typically, you just take the inverse of TS, rather than inverting each component matrix. Here we’re just showing what the inverses of the component matrices are.