3D Geometric
Transformation
(Chapt. 5 in FVD, Chapt. 11 in Hearn & Baker)
3D Coordinate Systems
Right-handed coordinate system:
z
y
x
Left-handed coordinate system:
y
z
x
Reminder: Vector Product
UxV
VxU
U V = n U V sin
x y z u y v z u z v y
U V = u x uy u z = u z vx u xvz
vx vy v z u x v y u y v x
3D Point
A 3D point P is represented in
homogeneous coordinates by a
4-dim. vector:
x
y
P=
z
1
Note, that
x x
y y
p=
z z
1
3D Transformations
In homogeneous coordinates, 3D
transformations are represented by
4x4 matrices:
a b c tx
d e f t
y
g h i tz
0 0 0 1
A point transformation is
performed:
x ' a b c tx x
' d e f t y y
y =
z ' g h i t z z
1 0 0 0 1 1
3D Translation
P in translated to P' by:
1 0 0 t x x x' x + t x
0 1 0 t y y y ' y + t y
= =
0 0 1 t z z z' z + t z
0 0 0 1 1 1 1
Or T P = P'
z
y
x
Inverse translation: T 1 P ' = P
Scaling
a 0 0 0 x x ' ax
0 b 0 0 y y ' by
= =
0 0 c 0 z z ' cz
0 0 0 1 1 1 1
Or S P = P'
z z
y y
x x
S 1 P ' = P
3D Shearing
Shearing:
1 a b 0 x x + ay + bz
c 1 d 0 y cx + y + dz
=
e f 1 0 z ex + fy + z
0 0 0 1 1 1
The change in each coordinate
is a linear combination of all
three.
Transforms a cube into a
general parallelepiped.
3D Rotation
To generate a rotation in 3D we
have to specify:
axis of rotation (2 d.o.f)
amount of rotation (1 d.o.f)
Note, the axis passes through the
origin.
z
x
A counter-clockwise rotation
about the z-axis:
x' cos sin 0 0 x
y ' sin 0 0 y
= cos
z' 0 0 1 0 z
1 0 0 0 1 1
p ' = R z ( ) p
y
x
A counter-clockwise rotation
about the x-axis:
x ' 1 0 0 0 x
y ' 0 cos 0 y
= sin
z ' 0 sin cos 0 z
1 0 0 0 1 1
p ' = R x ( ) p
y
x
A counter-clockwise 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 0 0 1 1
p ' = R y ( ) p
y
x
Inverse Rotation
p = R 1 ( ) p ' = R ( ) p '
Composite Rotations
Rx, Ry, and Rz, can perform any
rotation about an axis passing
through the origin.
Rotation About an
Arbitrary Axis
Axis of rotation can be located at
any point: 6 d.o.f.
The idea: make the axis
coincident with one of the
coordinate axes (z axis), rotate,
and then transform back.
Assume that the axis passes
through the point p0.
z
p0
y
x
Transformations:
Translate P0 to the origin.
Make the axis coincident with the
z-axis (for example):
Rotate about the x-axis into the
xz plane.
Rotate about the y-axis onto
the z-axis.
Rotate as needed about the z-
axis.
Apply inverse rotations about y
and x.
Apply inverse translation.
y y
A
p0 D p0
x
x z
z
y
y
E
p0
B p0
x
x z
z
y y
C p0 F p0
x x
z z
3D Reflection
A reflection through the xy plane:
1 0 0 0 x x
0 1 0 0 y y
=
0 0 1 0 z z
0 0 0 0 1 1
Reflections through the xz and the
yz planes are defined similarly.
How can we reflect through some
arbitrary plane?
Transforming Planes
Plane representation:
By three non-collinear points
By implicit equation:
x
Ax + By + Cz + D = [A B C D ] = 0
y
z
1
A B C
D 1
D D
P1
P2
[x y z 1]
P0
One way to transform a plane is
by transforming any three non-
collinear points on the plane.
Another way is to transform the
plane equation: Given a
transformation T that
transforms [x,y,z,1] to [x',y',z',1]
find [A',B',C',D'], such that:
x '
y '
[A' B ' C ' D '] = 0
z'
1
Note that
x
[A B C D ]T T
1 y
z
=0
1
Thus, the transformation that
we should apply to the plane
equation is:
A' A
B'
= T 1
C '
( )T B
C
D' D
Changing Coordinate
Systems
Problem: Given the XYZ
orthogonal coordinate system,
find a transformation, M, that
maps XYZ to an arbitrary
orthogonal system UVW.
This transformation changes a
representation from the UVW
system to the XYZ system.
w=(wx,wy,wz)
z
(x0,y0,z0)
u=(ux,uy,uz)
y
x
v=(vx,vy,vz)
Solution: M=RT where T is a
translation matrix by (x0,y0,z0), and
R is rotation matrix whose columns
are U,V, and W:
u x vx wx 0
u vy wy 0
R= y
u z vz wz 0
0 0 0 1
because
u x vx wx 0 1 u x
u vy wy 0 0 u y
RX = y = =U
u z vz wz 0 0 u z
0 0 0 1 1 1
Similarly, Y goes into V, and Z
goes into W.
The inverse transform, T-1R-1,
provides the mapping from
UVW back to XYZ. For the
rotation matrix R-1=RT:
u x uy uz 0 u x
0 u y
v vy vz
RT U = x
wx wy wz 0 u z
0 0 0 1 1
u x2 + u 2y + u z2 1
= 0 = 0 = X
0 0
1 1
Comment: Very useful if an
arbitrary plane is to be mapped
to the XY plane or vice versa.
Possible to apply if an arbitrary
vector is to be mapped to an
axis (How?).
Transformation Pipe-Line
Modeling
Coordinates
Modeling
Transformation
World Coordinates
Viewing
Transformation
Viewing Coordinates
Projection
Transformation
Projection Coordinates
Workstation
Transformation
Device Coordinates
Modeling Coordinate
Hierarchy zw
world
yw
xw
Tractor
System
Front-Wheel
System
World
transformation
Tractor
transformation
Front-wheel