need of 2d-transformation. types of transformation - translationtranslation - rotationrotation -...
TRANSCRIPT
2D TRANSFORMATIONS
To be discussed…
Need of 2D-transformation. Types of transformation - Translation - Rotation - Scaling Composite transformation Reflection Shearing
2D Transformations-The geometrical changes of an object from a
current state to modified state.
Need of transformation:-To manipulate the initially created object and to
display the modified object without having to redraw it.
2 ways◦ Object Transformation
Alter the coordinates descriptions of an object. Translation, rotation, scaling etc. Coordinate system remains unchanged.
◦ Coordinate transformation Produce a different coordinate system.
2D Transformations
Translation A translation moves all points
in an object along the same straight-line path to new positions.
The path is represented by a vector, called the translation or shift vector.
We can write the components:
p'x px +
p'y = py +
or in matrix form:
P' = P + T
tx
ty
’’
tx
ty
(2, 2)= 6
=4
?
Matrix Representation Point in column-vector:
Our point now has three coordinates. So our matrix is needs to be 3x3.
Translation:
xy1
1100
10
01
1
y
x
t
t
y
x
y
x
BACK
Rotation A rotation repositions
all points in an object along a circular path in the plane centered at the pivot point.
First, we’ll assume the pivot is at the origin.
P
P’
Rotation• We can write the components:
p'x = px cos – py sin p'y = px sin + py cos
• or in matrix form:
P' = R • P
• can be clockwise (-ve) or counterclockwise (+ve as our example).
P(x,y)
x
yr
x’
y’
P’(x’, y’)
cossin
sincosR
BACK
Scaling• Scaling changes the size of an object
and involves two scale factors, Sx and Sy for the x- and y- coordinates respectively.
• Scales are about the origin.• We can write the components: p'x = sx • px
p'y = sy • py
or in matrix form: P' = S • P Scale matrix as:
y
x
s
sS
0
0
P
P’
Matrix Representation Rotation
Scaling
1100
0cossin
0sincos
1
y
x
y
x
1100
00
00
1
y
x
s
s
y
x
y
x
BACK
Composite Transformation
We can represent any sequence of transformations as a single matrix.
Composite transformations:◦ Rotate about an arbitrary point – translate,
rotate, translate◦ Scale about an arbitrary point – translate, scale,
translate◦ Change coordinate systems – translate, rotate,
scale
Composite Transformation Matrix• Arrange the transformation matrices in order from right to left.• General Pivot- Point Rotation
• Operation :-1. Translate (pivot point is moved to origin)2. Rotate about origin3. Translate (pivot point is returned to original position)
T(pivot) • R() • T(–pivot)1 0 -tx
0 1 -ty
0 0 1
cos -sin 0sin cos 0 0 0 1
1 0 tx
0 1 ty
0 0 1. .
cos -sin -tx cos+ ty sin + tx
sin cos -tx sin - ty cos + ty
0 0 1
cos -sin -tx cos+ ty sin sin cos -tx sin - ty cos 0 0 1
1 0 tx
0 1 ty
0 0 1.
Composite Transformation Matrix
General Fixed-Point Scaling Operation :-
1. Translate (fixed point is moved to origin)2. Scale with respect to origin3. Translate (fixed point is returned to original
position)
BACK
Other transformations
Reflection:
x-axis y-axis
100
010
001
100
010
001
Other transformationsReflection:
origin line x=y
100
010
001
100
001
010
BACK
Other transformationsShear:
x-direction y-direction
100
010
01 xsh
100
01
001
ysh
BACK
Thankyou
BACK