Professional Documents
Culture Documents
Week 1
2D Transformations
3D Transformations
Graphics Pipeline
Coordinates
A point is represented by a pair of real
numbers (x, y)
There are two axes which serve as a reference
for measuring distance of each point from the
origin
Conventionally the X and Y axes are
perpendicular to each other. But need not be.
The coordinates give the length of projections
of the point onto the two axes
Coordinate Geometry
The coordinates of the
point depend upon the Y
location of the origin and
the direction of the axes
Coordinates change not
only when the point y P
moves to a new position,
but also when there is a x
X
change in the origin/axes O
Types of Transformation
Translation
Rotation
Scaling
Shearing
Y
R()
y' P'
x' cos -sin x
= y
y' sin cos
y P
X
x' x
NewCoords = Matrix * OldCoord
p' = M p
Rotation of Coordinate Axes
x' = r cos () =
Y' Y r cos cos + r sin sin
P y' = r sin () =
y P
r cos sin + r sin cos
X'
y'
x'
R(-)
X
x x' cos sin x
= y
y' -sin cos
Opposite Rotation of Axes
Y Y' x' = r cos cos - r sin sin
y' P
y' = r cos sin + r sin cos
X
y
x
R()
X'
x'
x' cos -sin x
= y
y' sin cos
Equivalent Matrices
Y
Y
Y'
y' P' y'
y P
y P
x X X
x' x
x' cos -sin x x'
= y
y' sin cos
X'
Multiple Transformations
Translation followed by rotation of a point
p΄ = R(p + t)
Rotation followed by translation of a point
p΄ = t + Rp
They are not identical
Rotation followed by translation followed by scaling
p΄ = s(t + Rp)
Cumbersome jumble of additions and multiplications !!
Homogeneous Coordinates
1 0 a s 0 0
T= 0 1 b S= 0 s 0
0 0 1 0 0 1
p' = M1 M2 M3 p
Shearing Transformation
Add part of X to Y
and vice versa! 1 shx 0
Squares turn into
parallelograms! shy 1 0
May be applied in 0 0 1
one direction only.
Transformations: Uniform Form
x x/w cos -sin 0
p= y = y/w R() = sin cos 0
w 1 0 0 1
1 0 a s 0 0 1 shx 0
Sh = shy 1 0
T= 0 1 b S= 0 s 0
0 0 1 0 0 1 0 0 1
p' = M1 M2 M3 p
3 Equivalent Viewpoints
p' = M p
Point p gets transformed by M and stays
in the same coordinate frame as p'
Coordinate frame changes by M-1 giving a
stationary point p new coordinates as p'
P'' = (-k, 0)
Y'
P' = (k cos , -k sin )
X'' X'
Y
P = (l + k cos , m - k sin )
lm Y'' P
X
L = R , = t
l
m
If P starts to move
Rotation by about a Y
point (a, b)
T(a, b) R() T(-a, -b)
Coordinate frame
moved to (a, b), rotated a
about new origin and b
X
moved to
(-a, -b) of the new
frame.
Example 1c
Y
X
Example 2
In place scaling and
rotation :
T(v) R() S(sx,sy) T(-v)
Rotations: Another View
Y cos -sin
Y
sin cos
X are unit vectors to which X
and Y axes move
X
cos sin
cos -sin 0
-sin cos
R() = sin cos 0 are unit vectors which
0 0 1 move to X and Y axes
Making Rotation Matrices
Columns give the vectors to which the axes
will move after rotation.
Rows give the vectors (before rotation) that
will sit on the axes after rotation.
This is alternate way to arrive at the rotation
matrix from what is known.
Example 3
Given a triangle (0,
0), (a, b), and (c, d),
how to align the side (a, b)
with the Y axis?
[a' b']T should sit on (c, d)
Y axis. Orthogonal
direction is [-b' a']T. -b' a' 0
They form the rows! a' b' 0
0 0 1
Summary