III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is...

37
III-1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1) In general, the homogeneous coordinate (x, y, z, w) represents the three dimensional point (x/w, y/w, z/w) 1 1 3 1 1 3 3 3 ] [ s n m l r j i g q f e d p c b a T • The generalized transformat ion matrix:

description

III- 3 Scaling can be done relative to the object center with a composite transformation Scaling an object centered at (c x, c y, c z ) is done with the matrix multiplication:

Transcript of III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is...

III-1

III 3D TransformationHomogeneous Coordinates

• The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1)

• In general, the homogeneous coordinate (x, y, z, w) represents the three dimensional point (x/w, y/w, z/w)

1131

1333][

snmlrjigqfedpcba

T

• The generalized transformation matrix:

III-2

Scaling• In general, this is done with the equations:

xn = sx * xyn = sy * yzn = sz * z

• This can also be done with the matrix multiplication:

wzyx

ss

s

wzyx

z

y

x

n

n

n

*

1000000000000

III-3

• Scaling can be done relative to the object center with a composite transformation

• Scaling an object centered at (cx, cy, cz) is done with the matrix multiplication:

wzyx

ccc

ss

s

ccc

wzyx

z

y

x

z

y

x

z

y

x

n

n

n

*

1000100010001

*

1000000000000

*

1000100010001

III-4

Shearing• Equivalent to pulling faces in opposite

directions•

III-5

III-6

III-7

III-8

III-9

Rotation• Rotation can be done around any line or vector• Rotations are commonly specified around the x,

y, or z axis• A positive angle of rotation results in a

counterclockwise movement when looked at from the positive axis direction

• The matrix form for rotation– x axis

wzyx

wzyx

n

n *

10000cossin00sincos00001

III-10

wzyx

wzyx

n

n

*

10000cos0sin00100sin0cos

wzyx

wzyx

n

n

*

1000010000cossin00sincos

– y axis

– z axis

III-11

III-12

III-13

III-14

Reflection• Reflection through the xy-plane:

• Reflection through the yz-plane:

• Reflection through the xz-plane:

III-15

III-16

III-17

Translations• The amount of the translation is added to or

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

xn = x + tx

yn = y + ty

zn = z + tz • This can also be done with the matrix

multiplication:

wzyx

ttt

wzyx

z

y

x

n

n

n

*

1000100010001

III-18

III-19

III-20

III-21

III-22

III-23

Combining Transformations

• Matrices can be multiplied together to accomplish multiple transformations with one matrix

• A matrix is built with successive transformations occurring from right to left

• A combination matrix is typically built from the identity matrix with each new transformation added by multiplying it on the left of the current combination

III-24

Rotation about an Arbitrary Axis in Space

• Assume an arbitrary axis in space passing through the point with direction cosines and rotation about this axis by some angle

),,( 000 zyx),,( zyx ccc

III-25

• Direction cosines:

III-26

• The complete transformation is:

III-27

III-28

III-29

III-30

III-31

III-32

Reflection through an Arbitrary Plane

III-33

• The general transformation is:

III-34

III-35

III-36

III-37