+ All Categories
Home > Documents > II-1 Transformations Transformations are needed to: Position objects defined relative to the origin...

II-1 Transformations Transformations are needed to: Position objects defined relative to the origin...

Date post: 18-Jan-2018
Category:
Upload: rosaline-harrell
View: 217 times
Download: 0 times
Share this document with a friend
Description:
II-3 Rotation Consider rotation about the origin by  degrees –radius stays the same, angle increases by  x’=x cos  –y sin  y’ = x sin  + y cos  x = r cos  y = r sin  x’ = r cos (  y’ = r sin ( 
20
II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects from three to two dimensions Transformations include: – Translation – Scaling – Rotation – Reflections Transformations can be represented by matrices and matrix multiplication II 2D Transformation
Transcript
Page 1: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-1

Transformations• Transformations are needed to:

– Position objects defined relative to the origin– Build scenes based on hierarchies– Project objects from three to two dimensions

• Transformations include:– Translation– Scaling– Rotation– Reflections

• Transformations can be represented by matrices and matrix multiplication

II 2D Transformation

Page 2: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-2

• Transformation of Points

yx

yx

• Representation of Points: ;

**)()( yxdybxcyaxdcba

yxTX

• Transformation of Straight Lines

Page 3: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-3

Rotation• Consider rotation about the origin by

degrees– radius stays the same, angle increases by

x’=x cos –y sin y’ = x sin + y cos

x = r cos y = r sin

x’ = r cos (y’ = r sin (

Page 4: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-4

• The transformation for a general rotation about the origin by an arbitrary angle

cossinsincos

T

cossinsincos

*** yxyxTXX

cossinsincos

T

yx

yx

XTX

cossinsincos

***

Page 5: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-5

Scaling• Scaling increases or decreases the size of the

object• Scaling occurs with respect to the origin

– If the object is not centered at the origin, it will move in addition to changing size

• In general, this is done with the equations:xn = sx * xyn = sy * y

• This can also be done with the matrix multiplication:

yx

ss

yx

y

x

n

n

00

Page 6: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-6

2002

T

2/1003

T• Example:

Page 7: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-7

Reflection• corresponds to negative scale factors

originalsx = -1 sy = 1

sx = -1 sy = -1 sx = 1 sy = -1

Page 8: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-8

10

01T

1001

T

0110

T

0110

T

• The reflection about the y=x is obtained by

• The reflection about the y-axis (x=0) is obtained by

• The reflection about the x-axis (y=0) is obtained by

• The reflection about the y=-x is obtained by

Page 9: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-9

Page 10: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-10

Page 11: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-11

Translations• The amount of the translation is added to or

subtracted from the x and y coordinates• In general, this is done with the equations:

xn = x + tx

yn = y + ty

• This can also be done with the matrix multiplication:

11001001

1yx

tt

yx

y

x

n

n

1010001

11

yx

nn

ttyxyx

Page 12: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-12

Homogeneous Coordinates• The two dimensional point (x, y) is represented by

the homogeneous coordinate (x, y, 1)• Some transformations will alter this third

component so it is no longer 1• In general, the homogeneous coordinate (x, y, w)

represents the two dimensional point (x/w, y/w)• General transformation matrix:

100

nmdcba

T

100ndcmba

T

Page 13: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-13

Order of Transformations• Matrix multiplication is not commutative so

changing the order of transformation can change the result

• For example, changing the order of a translation and a rotation produces a different result:

Page 14: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-14

Page 15: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-15

Page 16: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-16

Page 17: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-17

• Rotation about an arbitrary point through an angle

nm

1010001

1000cossin0sincos

1010001

11**

nmnmyxyx

Page 18: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-18

Page 19: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-19

Page 20: II-1 Transformations Transformations are needed to: Position objects defined relative to the origin Build scenes based on hierarchies Project objects.

II-20


Recommended