Computer Graphics: 3D-Transformations
Computer Graphics: 3D-Transformations
3D-Transformations
Translation
• Object translation
(x’,y’,z’)
T=(Tx,Ty ,Tz )
(x,y,z)
z
x
Sx 0 0 0
0 Sy 0 0
S
0 0 Sz 0
0 0 0 1
Where :
Sx,Sy and Sz are assigned are any positive values
Scaling relative to the origin coordinate
x Sx 0 0 0 x
y 0 Sy 0
0 y
z 0 0 Sz 0 z
1 0 0 0 1 1
Where Sx,Sy, and Sz are assigned any positive values. and we obtain:
x’ = x . Sx y’ = y . Sy z’ = z . Sz
Scaling
z
x
Scaling
• Uniform scaling
• when (Sx = Sy =Sz) the original shape is preserved.
y y
x x
x
z
x z
(1) (2)
Scaling about a fixed point
Scale with Sx 0 0 0 y
0 Sy 0 0
S
0 0 Sz 0
z
x
0 0 0 1 (3)
Translate the fixed point back to its the original position with
1 0 0 0 y
0 1 0 0
T
0 0 1 0 x
(4)
Tx Ty Tz 1 z
Scaling about a fixed point
The result :
Sx 0 0 0
0 S 0
0
S
y
0 0 Sz 0
(1 Sx) X F (1 Sy )Y F (1 Sz ) Z F 1
Rotation
3D Rotation is more complicated than 2D.
we must specify an axis of rotation.
In 2D the axis of rotation is always
perpendicular to the xy plane.
in 3D, the axis of rotation can have any spatial
orientation.
The amount of angular rotation:
Positive values for the angle indicate a
counterclockwise rotation.
Negative values for the angle rotate objects in
clockwise direction.
Rotation about the Z-Axis
x cos sin 0 0 x
y sin cos 0 0 y
z 0 0 1 0 z
1 0 1 1
0 0
Rotation about the X-Axis
x 1 0 0 0 x
y 0 cos sin 0 y
z 0 sin cos 0 z
1 0 0 0 1 1
Rotation about the Y-Axis
x cos 0 sin 0 x
y 0 1 0 0 y
z sin 0 cos 0 z
1 0 1 1
0 0
Rotation about an arbitrary axis
1 0 0 0
0 1 0 0
RFz = 0 0 -1 0
0 0 0 1
3D Reflections
• 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
A shear in the XY plane translates every plane
parallel to the XY plane by an amount in x and y
proportional to the z value of that plane.
Y
Y
Z
Z
3D Shears
1 0 shzx 0
0 1 shzy 0
M-Shear z = 0 0 1 0
0 0 0 1
3D Shears
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
• Donald Hearn, M. Pauline Baker Computer
Graphics (0-13-165598-1)
• http://www.cs.kuleuven.ac.be/~graphics/H331/
• http://www.siggraph.org/education/aterials/Hyper
Graph
• http://www.cosc.brocku.ca/Offerings/3P98/course/l
ectures/2d_3d_xforms/