Académique Documents
Professionnel Documents
Culture Documents
MSIT
kiran@students.iiit.net
Graphics Pipeline
Coordinates
� A point is represented by a pair of realnumbers (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 notbe.
� The coordinates give the length ofprojections of the point onto the two axes
Coordinate Geometry
� The coordinates of the
point depend upon thelocation of the origin andYthe direction of the axes
� Coordinates change not
only when the point movesto a new position, but also
y
O x
X
P
Types of Transformation
� Translation
� Rotation
� Scaling
� Shearing
In each case, it can be either the point
or the reference (origin + axes)
Translation of a point
� Translate the pointby (a, b) Y
�(x + a, y +b) arethe y'
coordinates of the b
new point in the old y
(same) coordinate
system.
p' = p + t
X
P
x
P'
x'
a
a b
Translation of Axes
� Translate the axes by
Y
(-a, -b).
Y'
X'
x'
a
p' = p + t
Transformations in reverse
� Translating the axes by (a, b) is the
same as translating each point by (-a,
-b)
� Similarly scaling the axes (zooming in)
is the same as zooming out of each
point
� Rotating the axes by an angle .
is the
same as rotating each point by thereverse angle -..
Coordinates under Scaling
�x' = s x,y' = s y.
� s is the scale factor.
Y
X
Rotation of a point about Origin
Y x= rcos a, y = r
sin a
y'
q
P'
x'
P
a
r cos a
q
q
r
Rotation: Matrix Notation
Y
R(q )
y'
xx
p' = M p
q
P'
'
P
a
Rotation of Coordinate Axes
x' = r cos (a -q )=
'
y' x'
q
Xy y'P
P
a
Y
R(-q )
Y'
y'
q
P
x' = r cos a
X
xy
a
cos q -r sin a sin q
y' = r cos a sin q + r sin a cos q
R(q )
X'
x'
p =
w
Transformations: Uniform Form
x
y
w
1
0
0
x/w
y/w
1
cos q
sin q
0
0
0
1
a
b
1
s
0
0
0
0
1
Shearing Transformation
�Add partof X to Y
and vice versa!
� Squares turn into
parallelograms!
� May be applied in
one direction only.
1 shx 0
shy 1 0
0 01
Transformations: Uniform Form
x x/w cos q -sin q 0
y y/w R(q ) = sin q cos q
p =
=
0 01
1 shx 0
10a s00
Sh = shy1 0
T = 0 1b S = 0 s0
001 001 001
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'
P = (l + k cos q , m - k sin q )
L = R q , q = w t
m
If P starts to move
q
X
Y X'
Y'
P
l
m
X''
Y'' l
P' = R(180 -q ) P''
P = T(l,m)P'
= T(l,m)R(180 -q )P''
� Rotation by q
about a point (a, b)
� T(a, b) R(q ) T(-a, Y
-b)
� Object brought toorigin, rotated andmoved back.
X
a
b
Example 1b
Rotation by q about a
point (a, b)
rotation :
cos q -sin q
sin q cos q
cos q sin q
cos q -sin q 0
-sin q cos q