Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of...
-
date post
19-Dec-2015 -
Category
Documents
-
view
232 -
download
3
Transcript of Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of...
Elementary 3D Transformations - a "Graphics Engine"
Transformation procedures
Transformations of coordinate systems
Translation
Scaling
Rotation
Transformation procedures
• A scene is made up of objects• Objects can be made of separately defined parts
• Each object / part defined by a list of points (vertices)
• Any part of the object can be moved or distorted by
applying a transformation to the list of points which
define it
Scalingabout the origin
X
Z
Y
A
B
C
D
A
B
C
D
x’ = x * Sxy’ = y * Syz’ = z * Sz
S > 1 - enlarge0 < S < 1 - reduceS < 0 - mirror
Scalingabout an arbitrary point
Scaling about a fixed point ( xc, yc, zc )
x' = xc + ( x – xc ) * Sx
y' = xc + ( y – yc ) * Sy
z' = zc + ( z – zc ) * Sz
Can also be achieved by a composite transformation.
Rotation
The direction of rotation in the left-handed system
Positive angle of rotation
when looking from a positive axis toward the origin
a 90o clockwise rotation transforms one positive
axis into the other.
Positive angle of rotation for Z axis
Y
X
Looking from the positive end of Z axis towards the origin
Rotation
Axis of rotation is Direction of positive rotation is
X from Y to Z
Y from Z to X
Z from X to Y
Matrix representationHomogeneous coordinates
• common notation for ALL transformations
• common computational mechanism for ALL transformations
• simple mechanism for combining a number of transformations => computational efficiency
Common matrix operation for all transformations???
• Translate (shift) point P• Scale point P• Rotate point P
Point (vector) P = [ xp yp zp ]
Matrix ???
Homogeneous coordinates
• Point P = (x, y, z ) represented by a vector
P =
• TransformationsAll represented by a 4 x 4 matrix T
T =
x
yz1
a d g j
b e h kc f i l0 0 0 1
x
yz1
Point transformation in homogeneous coordinates
x'
y'z'1
=
a d g j
b e h kc f i l0 0 0 1
x
yz1
• Implemented by matrix multiplicationP’ = T · P
Transformation matrices for elementary transformations
• 4 x 4 matrix
• Homogeneous coordinates
• Translation, scaling, rotation and perspective
projection, all defined through matrices
Rotation about Z axis
x' = x·cos - y·sin y' = x·sin + y·cos z' = z
Rz =
cos -sin 0 0
sin cos 0 00 0 1 00 0 0 1
Rotation about X axis
y' = y·cos - z·sin z' = y·sin + z·cos x' = x
Rx =
1 0 0 0
0 cos -sin 00 sin cos 00 0 0 1