Académique Documents
Professionnel Documents
Culture Documents
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
q
U
VxU
U ´V = nˆ U V sin
xˆ yˆ zˆ éu y v z - u z v y ù
ê ú
U ´V = ux uy u z = ê u z v x - u xv z ú
vx vy vz êë 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 ty ú
êg h i tz ú
ê ú
ë0 0 0 1û
• A point transformation is
performed:
é x 'ù éa b c tx ù é x ù
ê ú ê úê ú
ê y 'ú = êd e f t 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
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:
p' = Rz ( ) p
y
x
• A counter-clockwise 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 û
p' = Rx ( ) p
y
x
• A counter-clockwise rotation
about the y-axis:
p' = R y ( ) p
y
x
Inverse Rotation
p = R -1 ( ) p ' = R (- ) p '
Composite Rotations
• R x, R y, and R z, can perform any
rotation about an axis passing
through the origin.
Rotation About an
Arbitrary Axis
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 ùé x ù
0 é x ù
ê úê ú ê ú
ê0 1 0
0 úê y ú
= ê y ú
ê0 0 - 1 0 úê z ú ê- z ú
ê úê ú ê ú
ë0 0 0 0 ûë 1 û ë1 û
Transforming Planes
• Plane representation:
– By three non-collinear points
– By implicit equation:
é xù
ê ú
y
Ax + By + Cz + D = A B C Dê ú=0
ê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ù
ê ú
y
A B C DT Tê ú=0-1
êz ú
ê ú
ë1 û
é A' ù é Aù
ê ú ê ú
ê B' ú = T -1 T
ê Bú
ê C 'ú ê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,w z)
z
(x0,y 0,z0)
u=(ux,u y,uz )
y
x
v= (vx,vy ,vz )
éu x vx wx 0ù
ê ú
uy vy wy 0
R=ê ú
ê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 ù
ê úê ú
vx vy vz 0ú êu y ú
RTU = ê
ê wx wy wz 0ú êu z ú
ê úê ú
ë0 0 0 1û ë 1 û
éu 2x + u 2y + u 2z ù é1ù
ê ú ê ú
=ê
0 ú= ê0ú = X
ê 0 ú ê0ú
ê ú ê ú
ëê 1 ûú ë1û
Modeling
Transformation
Wo rld Co ordinates
Viewing
Transformation
Viewing Co ordinates
Projectio n
Transformation
Workstation
Transformation
Device Coordinates
Modeling Coordinate
Hierarchy zw
world
yw
xw
Trac tor
S ystem
F ront-Whee l
System
World
tra nsformation
Tractor
transformation
Front-wheel