You are on page 1of 37

TRANSFORMATIONS

Jayant P. Supale

J P Supale

Transformation Types

Translation
Rotation
Scaling
Reflection
Shearing

J P Supale

Translation -2D

X
J P Supale

P(x,y)

t
y
P(x,y)
t
x

J P Supale

Translation 2D
P = f(P)
x = x+tx;
y = y+ty;
The above equation can be written in
matrix form as:
X
Y

X
Y

tx
ty
J P Supale

Rotation

J P Supale

Rotation

r
Y=r.Sin()

X=r.Cos(
)
J P Supale

Rotation
Initial Position
X = r.Cos()
Y = r.Sin()
Final Position
X = r.Cos(+)
Y = r.Sin(+)
We can write
X= r.Cos()Cos() - r.Sin()Sin()
Y= r.Cos()Sin() + r.Sin()Cos()
From Initial position values
X= X.Cos() Y.Sin()
Y= X.Sin() + Y.Cos()

J P Supale

Rotation
The previous equations can be written
in matrix form as:
X
Y

Cos()
Sin()

Sin()
Cos()

X
Y

J P Supale

Scaling

Zoom In
(Enlarge
Scaling)

Zoom Out
(Reduce
Scaling)

J P Supale

Scaling
X = X.Sx
Y= Y.Sy
The above equation can be written in matrix form as:
X
Y

Sx
0

0
Sy

X
Y

If Sx = Sy Uniform Scaling
If Sx Sy Differential Scaling
Scaling Factor >1 Enlarges the Size of Object.
Scaling Factor <1 Reduces the Size of Object
J P Supale

Shear

X-Direction Shear

Y-Direction Shear

J P Supale

Shear
X-Direction Shear
X = X + Shx*Y
Y = Y

=
1
0

X
Y

Shx
1

X
Y

Y-Direction Shear
X = X
Y = X*Shy + Y

X
Y

1
Shy

0
1

X
Y
J P Supale

Reflection
-1
0

Y-Axis

0
1

(-X, Y)

(X, Y)

X-Axis

(-X, -Y)

-1
0

0
-1

(X, -Y)

1
0

0
-1

J P Supale

Reflection
Y-Axis

0 -1 10

0
1

1
0

Y = -X

Y=X

(-Y, -X)

(X, Y)

(Y, X)

(X, Y)

X-Axis
J P Supale

Homogeneous Coordinates
Transformations like Scaling, Reflection, Rotation
and Shear are accomplished by Matrix
multiplication.
Translation is the only transformation where
matrix addition takes place. Hence creates
ambiguity in concatenating matrix.
To avoid this problem homogeneous coordinates
are used.

J P Supale

Homogeneous Coordinates
In homogeneous coordinates the
point in n-dimensional space is
represented by (n+1) coordinates.
(X, Y) (Xh, Yh, h)
Where
Xh = h.X
&
Yh = h.Y
For convenience we are taking value
of h=1.
(X, Y) (X, Y, 1)
J P Supale

Homogeneous Coordinates
Translation
X
Y =
1
Rotation
X
Y
1
=
1

1
0
0

0
1
0

Cos()
Sin()
0

tx
ty
1

-Sin()
Cos()
0

X
Y
1

0
0

X
Y
1
J P Supale

Homogeneous Coordinates
Scaling
X
Y =
1

Sx
0
0

0
Sy
0

Shear in X-Direction
X
1
Shx
=
Y
0
1
1
0
0

0
0
1

X
Y
1

0
0
1

X
Y
1
J P Supale

Homogeneous Coordinates
Shear in Y-Direction
X
1
0
Y =
Shy
1
1
0
0

0
0
1

X
Y
1

Reflection (X- Axis as Mirror)


X =
1
0
0
Y
0
1
0
1
0
0
1

X
Y
1
J P Supale

Inverse Transformations
During the development of
composite transformation matrix
many a times it is necessary to use a
inverse of some transformation
matrices.
Inverse Translation
X =
1
0
-tx
X
Y
0
1
-ty
Y
J P Supale

Inverse Transformations
Inverse Rotation
X
Cos(-)
Y =
Sin(-)
1
0
Inverse Scaling
X
1/Sx
=
Y
0
1
0

-Sin(-)
Cos(-)
0

0
1/Sy
0

0
0

X
Y
1

0
0
1

The inverse reflection matrix is same as


reflection matrix.

X
Y
1

J P Supale

Scaling/Rotation about Arbitrary


Point
Translate the point P to origin of axes system.
Rotate /Scale the object by given values.
Translate the point back to its original position.
Multiply the above matrices from bottom to top
to get composite transformation matrix. Multiply
the composite matrix with vertices matrix.

J P Supale

Reflection about arbitrary


line
Translate the mirror line along Y-axis such that
line passes through line origin, O.
Rotate the mirror line such that it coincides with
X-axis.
Mirror the object through X-axis.
Rotate the mirror back to original angle with Xaxis.
Translate the mirror line along the Y-axis back to
original position.
Multiply the above matrices from bottom to top
to get composite transformation matrix. Multiply
the composite matrix with vertices matrix.

J P Supale

3-D Geometric
Transformation
Translation
X
Y
Z =
1
Scaling
X
Y
Z =
1

1
0
0
0

0
1
0
0

Sx
0
0
0

0
Sy
0
0

0
0
1
0
0
0
Sz
0

tx
ty
tz
1
0
0
0
1

X
Y
Z
1
X
Y
Z
1
J P Supale

3-D Geometric
Transformation
Rotation about X-axis
X
1
0
X
Y =
0
Cos()
Z
0
Sin()
1
0
0
Rotation about Y-axis
X
Cos()
0
Y
0
1
Z =
-Sin()
0
1
0
0

0
-Sin()
Cos()
0
Sin()
0
Cos()
0

0
0
0
1

Y
Z
1

X
0

Y
Z

J P Supa

3-D Geometric
Transformation
Rotation about Z-axis
X
Cos()
-Sin()
0 =
X
Y
Sin()
Cos()
0
Y
Z
0
0
0
Z
1
0
0
1
1

0
0
1
0
J P Supale

Types of Coordinate System


Model Coordinate System
(World/Global)
Working Coordinate System
(Local/User/Active)
Screen Coordinate System
J P Supale

Geometric Mapping
In CAD modeling, the user inputs the graphical information coordinate
data w. r. t. working coordinate system of the sketch plane while CAD
software stores the graphical information in the model database w r t
model coordinate system.
Model coordinate system is the only coordinate system that the
modeling software recognizes when storing or retrieving the graphical
information in or from model database.
Therefore, modeling software needs a tool to convert the graphical
information from one coordinate system to another coordinate
system.
Mapping of geometric model changes the graphical description of
model from one coordinate system to another without changing the
position, orientation, size and shape of model.
J P Supale

Difference between Geometric


Transformation and Geometric Mapping
Transformation

Geometric
transformation changes the
position, orientation, size and
or shape of graphic element
within the same coordinate
system.

This involves changes in


graphics element in same
coordinate system.

This involve one


graphics element and one
coordinate system.

Mapping

Geometric mapping
changes
the
graphical
description of the graphics
element from one coordinate
system to another without
changing
its
position,
orientation and size or shape.

This involve change in


coordinate system of same
graphic element.

This involve one


graphics element and 2
coordinate system.
J P Supale

Types of Geometric Mapping


Translational Mapping
Rotational Mapping
General Mapping

J P Supale

Translational Mapping
Y

0
0
Y

1
tx

0
1
0

ty
1

ty

X
tx

X
J P Supale

Rotational Mapping
Y

Cos()
0
Sin()
0
0

-Sin()
Cos()
0

Y*Cos()
X

X*Cos()

Y*Sin()

X*Sin()
X

J P Supale

General Mapping
Y

X
Y

tx
ty

Cos()
tx
Sin()
0 ty

-Sin()
Cos()
0

J P Supale

Numerical
The Coordinates of centre of circle in
Working Coordinate System are
(3,4.5). Find the coordinates of centre
of the circle with respect to Model
Coordinate System. The orientation
of Working Coordinate System and
Model Coordinate System are shown
in fig.

X
Y
30
5
6

You might also like