You are on page 1of 93

2D- Transformation

2D Transformations
Transformations
The geometrical changes of an object from a current state to
modified state.
Includes changing the size of an object, position on the screen and
orientation.

Transformations is needed
To manipulate the initially created object and to display the
modified object without having to redraw it.
Transformed Matrix = [ Original Object Matrix] * [ T/f Matrix ].


Two Ways
Object Transformation :-
Alter the coordinates descriptions an object
Translation, rotation, scaling etc.
Object is moved relative to Coordinate System
Coordinate system unchanged
Coordinate Transformation :-
Object held stationary.
Coord System is moved relative to the Object.
Produce a different coordinate system
2D Transformations

Geometric Transformation :

Operations that are applied to the geometric description of an
object to change its position, orientation, or size are called
Geometric Transformations.
In this object is moved relative to stationary object, coordinate
system or background.


So the geometric-transformation functions that are available in some
system are following:
1. Translation
2. Rotation
3. Scaling
4. Other useful transforms includes: reflection and shear.



Translation





Rotation
Scaling
Uniform Scaling




Un-uniform Scaling


Reflection




Shear



Why do we need geometric transformations in
CG( motivation )?

As a viewing aid
As a modeling tool
As an image manipulation tool






2 D- Translation
Translation is a rigid-body transformation that moves objects
without deformation.
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.
Perform Translation : Single Coordinate Point : by adding
offsets to its coordinates so as to generate a new coordinate
position.
Translation is applied to an object that is defined with multiple
coordinate positions by relocating all the coordinate positions by
the same displacement along parallel paths.


Two-Dimensional(2D) Translation

Suppose tx and ty is the translation distances, (x, y) is the original
coordinates, is the new coordinate position.

tx x x + =
'
y y ty
'
= +
'
( , ') x y
x x tx
y y ty
'
( ( (
= +
( ( (
'

Re-position a point along a straight line
Given a point (x,y), and the translation
distance (tx,ty)
The new point: (x, y)
x = x + tx
y = y + ty
(x,y)
(x,y)
OR P = P + T where P = x p = x T = tx
y y ty
tx
ty
3x3- 2D Translation Matrix
x = x + tx
y y ty
Use 3 x 1 vector
x 1 0 tx x
y = 0 1 ty * y
1 0 0 1 1
Note that now it becomes a matrix-vector multiplication
Two-Dimensional Rotation
Generate a rotation transformation of an object by
specifying a rotation axis and a rotation angle.
All points of the object are then transformed to new
positions by rotating the points through the specified angle
about the rotation axis.
2D rotation :Obtained by repositioning the object along a
circular path in the xy plane, the rotation axis is
perpendicular to the xy plane.
Parameters for 2D rotation is rotation angle and a
rotation point( pivot point) .
Rotation angle define a positive values for
counterclockwise rotation about the pivot point.

u
) , (
r r
y x
u
r is the constant distance of the point form
the origin, angle is the original angular
position of the point from the horizontal,
and is the rotation angle.







Substitute expression (1) into (2)
|
u
cos
sin
x r
y r
|
|
=

= + =
= + =
u u u
u u u
cos sin sin cos ) sin( '
sin sin cos cos ) cos( '
r r r y
r r r x

1
2



Matrix form

+ =
=
u u
u u
cos sin '
sin cos '
y x y
y x x
3
| | | |
cos sin

sin cos
x y x y
u u
u u
(
' '
=
(


2 D - Rotation
A rotation repositions
all points in an object
along a circular path in
the plane centered at
the pivot point.

First, well assume the
pivot is at the origin.

u
P
P
2 D - Rotation
(x,y)
(x,y)
u
|
r
x = r cos (|) y = r sin (|)
x = r cos (| + u) y = r sin (| + u)
x = r cos (| + u)
= r cos(|) cos(u) r sin(|) sin(u)
= x cos(u) y sin(u)
y = r sin (| + u)
= r sin(|) cos(u) + r cos(|)sin(u)
= y cos(u) + x sin(u)
2 D - Rotation
(x,y)
(x,y)
u
(x,y) -> Rotate about the origin by u
(x, y)
How to compute (x, y) ?
|
x = r cos (|) y = r sin (|)
r
x = r cos (| + u) y = r sin (| + u)
2 D - Rotation
(x,y)
(x,y)
u
|
r
x = x cos(u) y sin(u)
y = y cos(u) + x sin(u)
Matrix form?
x cos(u) -sin(u) x
y sin(u) cos(u) y
=
3 x 3?
3x3 2D Rotation Matrix
x cos(u) -sin(u) x
y sin(u) cos(u) y
=
(x,y)
(x,y)
u
|
r
x cos(u) -sin(u) 0 x
y sin(u) cos(u) 0 y
1 0 0 1 1
=
2 D - Rotation
Review Trigonometry
=> cos | = x/r , sin |= y/r
x = r. cos |, y = r.sin |

u
|
P(x,y)
x
y
r
x
y
u
P(x, y)
r
=> cos (|+ u) = x/r
x = r. cos (|+ u)
x = r.cos|cosu -r.sin|sinu
x = x.cos u y.sin u

=>sin (|+ u) = y/r
y = r. sin (|+ u)
y = r.cos|sinu + r.sin|cosu
y = x.sin u + y.cos u
Identity of Trigonometry
2 D - Rotation
We can write the components:
p'
x
= p
x
cos u p
y
sin u
p'
y
= p
x
sin u + p
y
cos u

or in matrix form:
P' = R P
u can be clockwise (-ve) or
counterclockwise (+ve as our
example).
Rotation matrix


u
P(x,y)
|
x
y
r
x
y
u
P(x, y)
(


=
u u
u u
cos sin
sin cos
R
2 D - Rotation
Default rotation center: Origin (0,0)
u can be clockwise (-ve) or counterclockwise (+ve )as
our example).
u
u> 0 : Rotate counter clockwise
u< 0 : Rotate clockwise
u
Example
Find the transformed point, P, caused by rotating P= (5,
1) about the origin through an angle of 90.
2 D - Rotation
(

+

=
(

-
(


u u
u u
u u
u u
cos sin
sin cos
cos sin
sin cos
y x
y x
y
x
(

+

=
90 cos 1 90 sin 5
90 sin 1 90 cos 5
(

+

=
0 1 1 5
1 1 0 5
(

=
5
1
Question 1:
If the rotation point is an arbitrary pivot position ,
can you give the correct rotation expression?






) , (
r r
y x
' ( ) cos ( ) sin
' ( ) sin ( ) cos
r r r
r r r
x x x x y y
y y x x y y
u u
u u
= +

= + +

3
Rotation ( Revision)
Applied to an Object by repositioning it along the
circular Path.
Point can be rotated through an Anlge Q.
Q +ve : Counterclockwise Rotation [ cos Q sin
Q, sin Q, cos Q]
Q ve: Anticlockwise Rotation. [ cos Q sin Q, -
sin Q cos Q]


2D- Scaling
Transformation that change the Size of or Shape of an
Object.
Scaling Factor Sx or Sy.
Scalinf Factor wrt origin is carried out by multiplying the
coordinate values (x,y) of each vertex of Polygon by Sx, Sy
to produce (x, y).



2D Scaling
Scale: Alter the size of an object by a scaling factor
(Sx, Sy), i.e.
x = x . Sx
y = y . Sy
x Sx 0 x
y 0 Sy y
=
(1,1)
(2,2)
Sx = 2, Sy = 2
(2,2)
(4,4)
2D Scaling
(1,1)
(2,2)
Sx = 2, Sy = 2
(2,2)
(4,4)
Not only the object size is changed, it also moved!!
Usually this is an undesirable effect
We will discuss later (soon) how to fix it
After applying Scaling factor : Object is either Inc. or Dec.
If Greater then 1 : Enlargement Object.
Less then 1 : Compression will occur.
Uniform Scaling : Sx = Sy >1 and Object becomes Larger.
Uniform Scaling : Sx = Sy <1 , and Object becomes Smaller.
If S
f
< 1 : Object moves Closer to Origin.
S
f
> 1: Object moves far from Origin
Differential Scaling : It is non uniform comprn which depends
upon Sx and Sy < or > 1, but unequal.



3x3 2D Scaling Matrix
x Sx 0 x
y 0 Sy y
=
x Sx 0 0 x
y = 0 Sy 0 * y
1 0 0 1 1
Or, 3x3 Matrix representations
Translation:


Rotation:


Scaling:


Why use 3x3 matrices?
x 1 0 tx x
y = 0 1 ty * y
1 0 0 1 1
x cos(u) -sin(u) 0 x
y sin(u) cos(u) 0 * y
1 0 0 1 1
=
x Sx 0 0 x
y = 0 Sy 0 * y
1 0 0 1 1
Why use 3x3 matrices?
So that we can perform all transformations
using matrix/vector multiplications

This allows us to pre-multiply all the matrices
together

The point (x,y) needs to be represented as
(x,y,1) -> this is called Homogeneous
coordinates!
Matrix Representations and Homogeneous
Coordinates
Many applications involves sequences of geometric
transformations.
For example, an animation might require an object to be
Translated, Rotated and Scaled at each increment of the
motion.
If you want to first rotates an object, then scales it, you can
combine those two transformation to a composite
transformation like the following equation:



0 cos sin
cos sin
*
0 sin cos
sin cos
x x x
y y y
S S S
A S R
S S S
u u
u u
u u
u u

( (
(
= = =
( (
(



However, it will be difficult to deal with the above composite
transformation and translation together. Because, translation is
not 2 by 2 matrix representation.

So ,here we consider how the matrix representations discussed in
the previous sections can be reformulated so that such
transformation sequences can be efficiently processed.

In fact, we can expressed three basic two-dimensional
transformation( translation, rotation, and scaling) in the
general matrix form:



Now this equation can be reformulated to eliminate the
matrix addition operation using Homogeneous Coordinates.
2 1
'
M P M P + - =
Homogeneous Coordinates

A standard technique for expanding each two-
dimensional coordinate position representation (x, y) to
three-element representation , called
Homogeneous Coordinates, where homogeneous h is
a nonzero value such that



For geometric transformation, we can chose the
homogeneous parameter h to be any nonzero value.
Thus there are an infinite number of equivalent
homogeneous representations for each coordinate
point (x, y) .


( , , )
h h
x y h
,
h h
x y
x y
h h
= =

A convenient choice is simply to set h=1, so each two-
dimensional position is then represented with
homogeneous coordinate (x,y,1).

Expressing positions in homogenous coordinates allows
us to represent all geometric transformation equations as
matrix multiplications, which is the standard method used
in graphics systems. Two dimensional coordinate positions
are represented with three-elements column vectors, and
two-dimensional transformation operations are expressed
as 3X3 matrices.
Homogeneous coordinate representation of 2D
Translation





This translation operation can be written in the
abbreviated form

(
(
(

(
(
(

=
(
(
(

'
'
1 1
0 1 0
0 0 1
1
y
x
ty tx
y
x
'
( , )
x y
P T t t P = -
(
(
(

(
(
(

=
(
(
(

'
'
1 1
0 1 0
0 0 1
1
y
x
ty tx
y
x
Homogeneous coordinate representation of 2D
Rotation

'
( ) P R P u = -
This translation operation can be written in the
abbreviated form
(
(
(

(
(
(


=
(
(
(

'
'
1 1 0 0
0 cos sin
0 sin cos
1
y
x
y
x
u u
u u
Homogeneous coordinate representation of 2D Scaling

(
(
(

(
(
(

=
(
(
(

'
'
1 1 0 0
0 0
0 0
1
y
x
sy
sx
y
x
'
( , ) P S sx sy P = -
This scaling operation can be written in the abbreviated
form
Properties of homogeneous coordinate 2D
transformation.
(1) translation and rotation have additive properties.




(2) scaling transformation has multiplicative properties.


( , ) ( , ) ( , )
x y h l x h y l
T t t T t t T t t t t - = + +
1 2 1 2
( ) ( ) ( ) R R R u u u u - = +
( , ) ( , ) ( , ) S sx st S sh sl S sx sh st sl - = - -
Composite Transformation
We can represent any sequence of
transformations as a single matrix.
No special cases when transforming a point
matrix vector.
Composite transformations matrix 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

Does the order of operations matter?

Composition Properties
Is matrix multiplication associative?
(A.B).C = A.(B.C)


(
(


+ + + + + +
+ + + + + +
=
(

(



-
(

(



+ +
+ +
=
dhl cfl dgj cej dhk cfk dgi cei
bhl afl bgj aej bhk afk bgi aei
l k
j i
dh cf dg ce
bh af bg ae
(

(



-
|
|
.
|


\
|
(

(



-
(

(



l k
j i
h g
f e
d c
b a
(

(



+ + + + + +
+ + + + + +
=
(

(



+ +
+ +
-
(

(



=
dhl dgj cfl cej dhk dgi cfk cei
bhl bgj afl aej bhk bgi afk aei
hl gj hk gi
fl ej fk ei
d c
b a
|
|
.
|


\
|
(

(



-
(

(



-
(

(



l k
j i
h g
f e
d c
b a
?
Is matrix multiplication commutative?
A . B = B . A
Composition Properties
?
(

+ +
+ +
=
(

-
(

dh cf dg ce
bh af bg ae
h g
f e
d c
b a
(

+ +
+ +
=
(

-
(

hd gb hc ga
fd eb fc ea
d c
b a
h g
f e
Order of operations
So, it does matter. Lets look at an
example:
1. Translate
2. Rotate
1. Rotate
2. Translate
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 origin
3. Translate (pivot point is returned to original position)
T(pivot) R(u) T(pivot)
1 0 -
t
x
0 1 -
t
y
0 0 1
cosu -sinu 0
sinu cosu 0
0 0 1
1 0 t
x
0 1 t
y
0 0 1
. .
cosu -sinu -t
x
cosu+ t
y
sinu + t
x

sinu cosu -t
x
sinu - t
y
cosu + t
y

0 0 1
cosu -sinu -t
x
cosu+ t
y
sinu
sinu cosu -t
x
sinu - t
y
cosu
0 0 1
1 0 t
x
0 1 t
y
0 0 1
.
Example
Perform 60 rotation of a point P(2, 5) about a pivot
point (1,2). Find P?
Composite Transformation Matrix
cosu -sinu -t
x
cosu+ t
y
sinu + t
x

sinu cosu -t
x
sinu - t
y
cosu + t
y

0 0 1
x
y
1
.
0.5 -0.866 -1.0.5 + 2.0.866 + 1
0.866 0.5 -1.0.866- 2.0.5 + 2
0 0 1
2
5
1
.
0.5 - 0.866 2.232
0.866 0.5 0.134
0 0 1
2
5
1
.
=
-1.098
4.366
1
P = (-1, 4)
Sin 60 = 0.8660
Kos 60 = 1/2
Without using composite homogenus
matrix
Example
Perform 90 rotation of a point P(5, 1) about a pivot point
(2, 2). Find P?
1. Translate pivot point ke asalan ( tx = -2, ty = -2)
Titik P(5, 1 ) P (3, -1)
2. Rotate P = 90 degree
P(3, -1) -- > kos 90 -sin 90 3 = 0 -1 3 =
1
sin 90 kos 90 - 1 1 0 -1
3
3. Translate back ke pivot point (tx = 2 , ty = 2)
titik (1, 3 ) titik akhir (3, 5)
Composite Transformation Matrix
General Fixed-Point Scaling
Operation :-
1. Translate (fixed point is moved to origin)
2. Scale with respect to origin
3. Translate (fixed point is returned to original position)
T(fixed) S(scale) T(fixed)
Find the matrix that represents scaling of
an object with respect to any fixed point?

Given P(6, 8) , Sx = 2, Sy = 3 and fixed
point (2, 2). Use that matrix to find P?

Answer
1 0 -
t
x
0 1 -
t
y
0 0 1
Sx 0 0
0 Sy 0
0 0 1
1 0 t
x
0 1 t
y
0 0 1
. .
Sx 0 -t
x
Sx
0 Sy -t
y
Sy
0 0 1
1 0
t
x
0 1
t
y
0 0 1
.
=
x =6, y = 8, Sx = 2, Sy = 3, t
x
=2, t
y
= 2
Sx 0 -t
x
Sx + t
x

0 Sy -t
y
Sy + t
y

0 0 1
2 0 -2(

2) + 2
0 3 -2(3) + 2
0 0 1
.
6
8
1
=
10
20
1
Composite Transformation Matrix
General Scaling Direction
Operation :-
1. Rotate (scaling direction align with the coordinate axes)
2. Scale with respect to origin
3. Rotate (scaling direction is returned to original position)
R(u) S(scale) R(u)

Find the composite transformation matrix
by yourself !!
Two-Dimensional Composite Transformation
Using matrix representations, we can set up a
sequence of transformation as a composite
transformation matrix, by calculating the product of the
individual transformations.
And, since many positions in a scene are typically
transformed by the same sequence, its is more
efficient to first multiply the transformation matrices to
form a single composite matrix.



So the coordinate position is transformed using the
composite matrix M, rather than applying the individual
transformations M1 and then M2

'
2 1
P M M P
M P
= - -
= -
Composite Two-Dimensional Translations, Rotation
and Scaling:



( , ) ( , ) ( , )
x y h l x h y l
T t t T t t T t t t t - = + +
1 2 1 2
( ) ( ) ( ) R R R u u u u - = +
( , ) ( , ) ( , ) S sx st S sh sl S sx sh st sl - = - -
General Two-Dimensional Pivot-Point Rotation





So we can generate a 2D rotation about any other pivot
point (x, y) by performing the following sequence of
translate-rotate-translate operations.
(x
r
,y
r
) (x
r
,y
r
) (x
r
,y
r
) (x
r
,y
r
)
(1) Translate the object so that the pivot-point position
is moved to the coordinate origin.
(2) Rotate the object about the coordinate origin.
(3) Translate the object so that the pivot point is
returned to its original position.
The composite transformation matrix for this
sequence is obtained with the concatenation:
1 0 1 0 cos sin (1 cos ) sin cos sin 0
0 1 sin cos 0 0 1 sin cos (1 cos ) sin
0 0 1 0 0 1 0 0 1 0 0 1
r r r r
r r r r
x x x y
y y y x
u u u u u u
u u u u u u
+ ( ( ( (
( ( ( (
=
( ( ( (
( ( ( (

Which can be expressed in the form

( , ) ( ) ( , ) ( , , )
r r r r r r
T x y R T x y R x y u u - - =
Similarly, we can obtain the matrix representation of
General 2D Fixed-Point Scaling.( question ).
(1) Translate the object to so that the fixed point coincides
with the coordinate origin.

(2) Scale the object with respect to the coordinate origin.

(3) Use the inverse of the translation in step (1) to return
the object to its original position.


(
(
(

=
(
(
(

(
(
(

(
(
(

1 0 0
) 1 ( 0
) 1 ( 0
1 0 0
1 0
0 1
1 0 0
0 0
0 0
1 0 0
1 0
0 1
y f y
x f x
f
f x
f
f
s y s
s x s
y
x
s
s
y
x
y
Translate Scale Translate
(x
r
,y
r
) (x
r
,y
r
) (x
r
,y
r
) (x
r
,y
r
)
( ) ( ) ( ) ( )
y x f f f f y x f f
s s y x S y x T s s S y x T , , , ,
, ,
=
We also obtain General 2D Scaling Directions.
Suppose we want to apply scaling factors with
values specified by parameters s1 and s2 in the
directions shown in the following fig.

u
To accomplish the scaling without changing the orientation
of the object.
(1) we perform a rotation so that the directions for s1 and
s2 coincide with the x and y axes, respectively.
(2) Then the scaling transformation S(s1,s2) is applied.
(3) An opposite rotation to return points to their original
orientations.
(
(
(

+
+
=

1 0 0
0 cos sin sin cos ) (
0 sin cos ) ( sin cos
) ( ) , ( ) (
2
2
2
1 1 2
1 2
2
2
2
1
2 1
1
u u u u
u u u u
u u s s s s
s s s s
R s s S R
For example, we turn a unit square into a parallelogram
by stretching it along the diagonal from (0,0) to (1,1).
x
y
(0,0)
(3/2,1/2)
(1/2,3/2)
(2,2)
x
y
(0,0)
(1,0)
(0,1)
(1,1)
Scale
We first rotate the diagonal onto the y axis using angle
45 degree. Then we double its length with the scaling
values s1=1 and s2=2, and then we rotate again to return
the diagonal to its original orientation.
Matrix Concatenation Properties
(1) Multiplication of matrices is associative.
(2) Transformation products, on the other hand, may not be
commutative.
Combined Tranformation
A number of transformations can be combined into
one matrix to make things easy.
Allowed by the fact that we use homogenous coordinates
Imagine rotating a polygon around a point other than
the origin
Transform to centre point to origin
Rotate around origin
Transform back to centre point


Combining Transformations
(cont)
) (H House
H dy dx T ) , (
H dy dx T R ) , ( ) (u H dy dx T R dy dx T ) , ( ) ( ) , ( u
1
2
3
4
Combining Transformations
(cont)
The three transformation matrices are combined
as follows
(
(
(

(
(
(

(
(
(

(
(
(

1 1 0 0
1 0
0 1
1 0 0
0 cos sin
0 sin cos
1 0 0
1 0
0 1
y
x
ty
tx
ty
tx
u u
u u
v dy dx T R dy dx T v ) , ( ) ( ) , ( ' u =
REMEMBER: Matrix multiplication is not
commutative so order matters
Combining Transformations
(cont)
The three transformation matrices are combined
as follows
v dy dx T R dy dx T v ) , ( ) ( ) , ( ' u =
(
(
(

(
(
(

(
(
(

(
(
(

1 1 0 0
1 0
0 1
1 0 0
0 cos sin
0 sin cos
1 0 0
1 0
0 1
y
x
ty
tx
ty
tx
u u
u u
REMEMBER: Matrix multiplication is not
commutative so order matters
If Two Translations are applied then :

[ 1 0 tx1, 1 0 ty1, 0 0 1] * [ 1 0 tx2, 1 0 ty2, 0 0 1]
then Result Is : [1 0 tx1+tx2, 1 0 ty1+ty2, 0 0 1].

If Two Rotations are applied then :-
[ cos (Q1+Q2) -sin(Q1+Q2) 0
sin (Q1+Q2) cos (Q1+Q2) 1
0 0 1 ]



If Two Scalings are Applied then :-

[ Sx1.Sx2 0 0
0 Sy1.y2 0
0 0 1]

Inverse Transformations
Transformations can easily be reversed using
inverse transformations
T
-1
= 1 0 -Tx
0 1 -Ty

0 0 1
R
-1
= Cos Q Sin Q 0

-Sin Q Cos Q 0
0 0 1




S
-1
= 1/Sx 0 0
0 1/Sy 0
0 0 1
Inverse Transformation
Rotation About An Arbitrary Point :-
[T] = [ Tr ] [Rq] [Tr
-1
]
where Tr = Translation Matrix
Rq = Rotation Matrix
Tr
-1
= Inverse Translation Matrix
Scaling :Fixed Point
[T] [Sx][T
-1
]
Exercises 1
x
y
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
(2, 3)
(3, 2) (1, 2)
(2, 1)
Translate the shape below by (7, 2)
Exercises 2
x
y
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
(2, 3)
(3, 2) (1, 2)
(2, 1)
Scale the shape below by 3 in x and 2 in y
Exercises 3
Rotate the shape below by 30 about the origin
x
y
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
6
(7, 3)
(8, 2) (6, 2)
(7, 1)
Exercise 4
Write out the homogeneous matrices for the
previous three transformations
(
(
(

__ __ __
__ __ __
__ __ __
(
(
(

__ __ __
__ __ __
__ __ __
(
(
(

__ __ __
__ __ __
__ __ __
Translation Scaling Rotation
Exercises 5
Using matrix multiplication calculate the
rotation of the shape below by 45 about its
centre (5, 3)
x
y
0
1
1
2
2
3 4 5 6 7 8 9 10
3
4
5
(5, 4)
(6, 3) (4, 3)
(5, 2)

REFLECTION: Produce Mirror Image of An Object.
Reflection with respect to the axis
X axis y axis original point

(
(
(

1 0 0
0 1 0
0 0 1
(
(
(

1 0 0
0 1 0
0 0 1
(
(
(

1 0 0
0 1 0
0 0 1
x
y 1
3 2
1
3 2
x
y
1
3 2
1
3 2
x
y
3
1
3 2
1
2
Reflection X Axis
Image of an Object is formed on the side
opposite to where
the object is lying wrt mirror line.
Perpendicular distance is same from the mirror
line to the distance of reflected image.
X = x and Y = -y
[ 1 0
0 -1]
[ x = [ 1 0 * [ x
y ] 0 -1] y]
Reflection Along Y Axis ( X = 0)
X = -x
Y = y
[ -1 0
0 1 ]
Reflection About Origin
Mirror Line is Axis Perpendicular to xy plane and
will pass through origin .
When Reflection done , then both X and Y Coor.
Flipped.
X = - X and Y = -Y.
Matrix :
[ x = [ -1 0 * [ x
y] 0 -1 ] y]
Reflection with respect to a line
(
(
(

1 0 0
0 0 1
0 1 0
x
y
Reflection About Line Y = - X
Line Y = -x becomes x = -y and y = -x.
Represented as
[ x = [ 0 -1 * [ x
Y] -1 0] y]
Shear
Two common shearing transformations are those
that shift coordinate x values and those that shift y
values.
An x-direction shear relative to the x axis is produced
with the transformation matrix
(
(
(

1 0 0
0 1 0
0 1
x
sh
x = x + shx y, y = y
x
y
x
y
(0,0) (1,0)
(1,1)
(0,1)
(0,0) (1,0)
(3,1) (2,1)
Any real number can be assigned to the shear parameter
shx. A coordinate position (x, y) is then shifted horizontally
by an amount proportional to its perpendicular distance ( y
value ) from the x axis.

We can generate x-direction shears relative to other
reference lines with yref=-1.
Now, coordinate positions are transformed as
x = x + shx (y-yref), y = y


(3,1)




The following Fig. illustrates the conversion of a
square into a parallelogram with shy=0.5 and yref=-1.
(
(
(


1 0 0
0 1 0
1
ref x x
y sh sh
x
y
x
y
(0,0) (1,0)
(1,1)
(0,1)
(1/2,0)
(3/2,0)
(2,1)
(1,1)
(0,-1)
Shearing operations can be expressed as a sequences of
basic transformations. Such as a series of rotation and
scaling matrices

You might also like