Three-Dimensional Transformations
Three-Dimensional Transformations
Three-Dimensional Transformations
TRANSFORMATIONS
Introduction
We can create a variety of pictures and graph forms.
We need altering or manipulation displays.
We need to change the size of an object or graph.
Various manipulations are carried out by applying
appropriate geometric transformations.
Displayed objects are defined by sets of coordinate
points. Geometric transformations are procedures for
calculating new coordinate positions for these points.
Why are transformations useful?
Define objects only once, then transform to compose
bigger objects
Computer animation
• Translate / rotate / move object over time
Cartesian coordinate system
3D Point Representation
A 3D point P is represented in homogeneous
coordinates by a 4-dimensional vector:
X
P= x y z 1
Y
P=
Z
1
Transformation Matrix
Given two frames in an affine space of dimension n, we can find a
(n+1) x (n+1) matrix that converts the coordinates of a point in the
first frame to the coordinates of the same point in the second
frame. The operation are called transformation. The matrix is
called transformation matrix. In 3D space, for example, the
g e n e r a l f o r m o f t h e m a t r i x i s
z z
Ty
Tz
X X
TX
3D Translation
Geometric translation equations can be expressed in
terms of transformation matrices.
1 0 0 0
x’ y’ z’ 1 x y z 1 0 1 0 0
=
0 0 1 0
Tx Ty Tz 1
x’ = x + Tx y’ = y + Ty z’ = z + Tz
3D Translation
An object is translated in 3D by transforming
each of its defining points.
We obtain the inverse of the translation
matrix by negating the translation distances
Tx,Ty and Tz.
• this produces a translation in the opposite
direction, and the product is the identity matrix.
Translation a point
y
X Sy
X
SX
3D Scaling
The matrix operation for scaling in 3D
relative to the origin coordinate is
Sx 0 0 0
x’ y’ z’ 1 x y z 1 0 Sy 0 0
=
0 0 Sz 0
0 0 0 1
Where Sx,Sy, and Sz are assigned any positive values. and we obtain:
x’ = x . Sx y’ = y . Sy z’ = z . Sz
3D Scaling
As in 2D, if the object is not centered at the origin (0, 0, 0) the
scaling transformation causes both size change and
movement of the object.
Scaling about a fixed point P (x0,y0,z0) can be accomplished
by the following:
1. translating P to the origin
2. scaling the object
3. translating P back to original position.
so the composite matrix is
T(-x0,-y0,-z0)*(S(Sx,Sy,Sz))*(T(x0,y0,z0))
Inverse Scaling: replace Sx with 1/Sx, Sy with 1/Sy, and Sz
with 1/Sz, then S(S-1) = 1
3D Scaling
y
y
y
z
x z
In the beginning Step 1
3D Scaling
y
y
x
x
z Step 4
Step 3
z
3D Rotation
3D Rotation is more complicated than 2D.
Y
Y
qy
Z Z
X X
3D Rotation about the z-axis
cosθ sinθ 0 0
x’ y’ z’ 1 x y z 1 -sinθ cosθ 0 0
=
0 0 1 0
0 0 0 1
Y Y
qx
Z Z
X X
3D Rotation about the x-axis
1 0 0 0
x’ y’ z’ 1 x y z 1 0 cosθ sinθ 0
=
0 -sinθ cosθ 0
0 0 0 1
Y Y
Z Z
qz
X X
3D Rotation about the y-axis
cosθ 0 -sinθ 0
0 1 0 0
x’ y’ z’ 1 = x y z 1
sinθ 0 cosθ 0
0 0 0 1
1 0 0 0
0 1 0 0
RFz = 0 0 -1 0
0 0 0 1
3D Reflections
Likewise, a reflection about the yz plane reverses
the sign of the x-coordinates, and a reflection about
the xz plane reverses the sign of the y-coordinates.
-1 0 0 0 1 0 0 0
0 1 0 0 0 -1 0 0
RFx = 0 0 1 0 RFy = 0 0 1 0
0 0 0 1 0 0 0 1
3D Shears
Y
Y
X
X
Z
Z
3D Shears
A shear operation in 3D is a fairly straightforward
extension of a shear operation in 2D
A 3D shear relative to the z-axis is accomplished by:
1 0 shzx 0
0 1 shzy 0
M-Shear z = 0 0 1 0
0 0 0 1
3D Shears
A 3D shear relative to the x-axis and y-axis are
accomplished by:
1 0 0 0 1 shyx 0 0
shxy 1 0 0 0 1 0 0
M-Shearx = M-Sheary =
shxz 0 1 0 0 shyz 1 0
0 0 0 1 0 0 0 1
References
http://www.cs.kuleuven.ac.be/~graphics/H331/
http://www.siggraph.org/education/aterials/HyperGraph
http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/2d_3d_xforms/