Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2D GEOMETRICAL TRANSFORMATIONS
Institute of Information and Communication Technology
University of Sindh, Jamshoro
2D GEOMETRICAL
TRANSFORMATIONS
Translation
Scaling
Rotation
Shear
Matrix notation
Compositions
Homogeneous coordinates
2D GEOMETRICAL
TRANSFORMATIONS
Assumption: Objects consist of points and lines.
A point is represented by its Cartesian coordinates:
P = (x, y)
Geometrical Transformation:
Let (A, B) be a straight line segment between the points A and B.
Let T be a general 2D transformation.
T transforms (A, B) into another straight line segment
TRANSLATION
SCALE
SCALE
How can we scale an object without moving its origin (lower left
corner)?
REFLECTION
Special case of scale
ROTATION
Rotate(): (x, y) (x cos()+y sin(), -x sin()+y cos())
ROTATION
How can we rotate an object without moving its origin (lower left
corner)?
SHEAR
Shear (a, b): (x, y) (x+ay, y+bx)
CLASSES OF TRANSFORMATIONS
Rigid transformation (distance preserving):
Translation + Rotation
Similarity transformation (angle preserving):
Translation + Rotation + Uniform Scale
Affine transformation (parallelism preserving):
Translation + Rotation + Scale + Shear
MATRIX NOTATION
2D TRANSFORMATIONS
2D object is represented by points and lines that join
them
TRANSLATION
To translate a point with coordinate (x1, y1) to a new location using
displacements (dx, dy), following equations can be used:
x2 = x1 +dx
and
y2 = y1+dy
Here (x2, y2) is the new coordinate of the point. The above equation
can be represented in matrix notation as:
2
1
=
+
2
1
Where
1
v1 =
1
2
V2 =
2
SCALE
The size of an object can be changed by the scaling transformation.
Objects can be scaled either the X or Y direction, or both of them
simultaneously, scaling by scale factors sx and sy along the X and Y
directions can be expressed mathematically as
x2 = sxx1
and
y2 = syy1
Here (x2, y2) is the new coordinate of the point. The above equation can
be represented in matrix notation as:
2
1
=
x
2
1
2
V2 =
2
Reflection
<
0
>
Decrease Size
(No Object/Size 0)
<
1
>
Increase Size
(Same Size)
Scale
Scale (a, b):
a
0
by
b y
ROTATION
Rotation can be performed in an
anticlockwise or a clockwise direction.
The axis of rotation may be X-axis or Y-axis
or any arbitrary line on the X-Y plane.
Rotations are performed about some fixed
point called pivot point or centre of rotation
or anchor point.
Rotations are measured by angular
displacements, we measure coordinate value
in term of the radius of rotation and angle
of rotation, i.e. polar coordinates.
Rotation
Rotate(
(x, y) (x cos()+y sin(), -x sin()+y cos())
cos
sin
Shear
Shear (a, b): (x, y) (x+ay, y+bx)
1
b
a x
x ay
1 y
y
bx
Reflection
Reflection through the y axis:
1
0
0
1
0
1
Reflection through y = x:
0
1
1
0
1
0
Composition of Transformations
A sequence of transformations can be
collapsed into a single matrix:
x
x
A B C D
y
y
rotate
rotate
translate
Translation
Translation (a, b):
x
y
x a
y b
Homogeneous Coordinates
Is a mapping from Rn to Rn+1:
( x , y ) ( X , Y , W ) ( tx , ty , t )
( X ,Y ,W )
Y
,
W
TRANSLATION
SHEAR
THANKYOU
Q&A
Referred Book
Computer Graphics: Principles and Practice in C,
by J. D. Foley, A. Van Dam, S. K. Feiner, J. F. Hughes.
Hardcover, 1200 pages, Addison-Wesley Pub Co; 2nd edition,
For Course Slides and Handouts
web page:
https://sites.google.com/site/drzeeshanacademy/
Blog:
http://zeeshanacademy.blogspot.com/
Facebook:
https://www.facebook.com/drzeeshanacademy
29