cse3431-lecture3.key
Elementary Affine
Transformations
Any affine transformation is equivalent
to a combination of four elementary
affine transformations
• Translation
• Scaling
• Rotation
• Shear
Translation
x
y
d
(0,0)
Scaling around the origin
x
y
(0,0)
Rotation around the origin
x
y
(0,0)
+
Shear around the origin
In the x-direction
x
y
(0,0)
Zero point
All elementary affine transformations have one or more
‘zero’ or ‘identity’ points except translation
F(P) = P
What are these points for Shear(), Scale() and
Rotate() ?
Inverse of a Transformation
Cramer’s rule or we can be smarter
• Inverse transformation: Q = MP, P = M-1Q
P
Q
M
M-1
Inverse of Translation
Inverse of Scaling
Inverse of Rotation
Inverse of a Shear in x
Composing 2D Affine
Transformations
Composing two affine transformations
produces an affine transformation
Main Points
Any affine transformation can be
performed as series of elementary
transformations.
Affine transformations are the main
modeling tool in graphics.
Make sure you understand the order.
Examples
Reflection
Rotation about an arbitrary pivot
point
Scaling around an arbitrary point
Reflection about a tilted line
Example of 2D transformation
Rotate around an arbitrary point O by -90 degrees:
x
y
P
O
Rotate around an arbitrary point
Rotate around an arbitrary point O by -90 degrees:
x
y
P
O
P’
90
Rotate around an arbitrary point
We know how to rotate around the origin
x
y
P
O
Rotate around an arbitrary point
…but that is not what we want to do!
x
y
P
O
P’
90
P’
So what do we do?
x
y
P
A
Transform it to a known case
Translate(-Ox,-Oy)
x
y
P’
O’
P
O
Second step: Rotation
Translate(-Ox,-Oy)
Rotate(-90)
x
y
P’’
O’
P
O
P’
P’
Final: Put everything back
Translate(-Ox,-Oy)
Rotate(-90)
Translate(Ox,Oy)
x
y
P’’’
O’
P
O
P’’
P’
Rotation about arbitrary point
IMPORTANT!: Order
M = T(Ox,Oy)R(-90)T(-Ox,-Oy)
x
y
P’’’
O’
P
O
P’’
Affine Transformations in 3D
Affine Transformations in 3D
General form
Elementary 3D Affine
Transformations
Translation
Scaling Around the Origin
• Uniform scaling: sx = sy = sz
Shear around the origin
Along x-axis
3 DRotation
Various representations
Decomposition into axis
rotations (x-roll, y-roll, z-roll)
CCW positive assumption
Reminder 2D z-rotation
Three axis to rotate around
Qx = cos�Px � sin�Py
Qy = sin�Px + cos�Py
Qz = Pz
Rz(�) =
�
⇧⇧
⇤
cos(�) �sin(�) 0 0
sin(�) cos(�) 0 0
0 0 1 0
0 0 0 1
⇥
⌃⌃
⌅
Z-roll
X-roll
Cyclic indexing
0
Y-roll
0
Inversion of transformations
Translation: T-1(a,b,c) = T(-a,-b,-c)
Rotation: R-1axis(b) = Raxis(-b)
Scaling: S-1(sx,sy,sz) = S(1/sx,1/sy,1/sz)
Shearing: Sh-1(a) = Sh(-a)
Inverse of Rotations
Pure rotation only, no
scaling or shear.
Composition of 3D Affine
Transformations
The composition of affine transformations
is an affine transformation.
Any 3D affine transformation can be
performed as a series of elementary affine
transformations.
Composite 3D Rotation around
origin
The order is important !!
It is often convenient to use other
representations for 3D rotations….
Gimbal lock
Loss of degree of freedom
Rotation around an arbitrary axis
Euler’s theorem: Any rotation or sequence of
rotations around a point is equivalent to a single
rotation around an axis that passes through the
point.
What does the matrix look like?