III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is...
description
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-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-14
Reflection• Reflection through the xy-plane:
• Reflection through the yz-plane:
• Reflection through the xz-plane:
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-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