TRANSFORMATIONS
Transformation Types
• Translation
• Rotation
• Scaling
• Reflection
• Shearing
Translation -2D
X
P’(x’,y’)
ty
P(x,y)
tx
Translation – 2D
• P’ = f(P)
• x’ = x+tx;
• y’ = y+ty;
• The above equation can be written in matrix
form as:
X’ X tx
= +
Y’ Y ty
Rotation
Rotation
r
Y=r.Sin(α)
α
X=r.Cos(α)
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(θ)
Rotation
The previous equations can be written in matrix
form as:
X’ Cos(θ) – Sin(θ) X
=
Y’ Sin(θ) Cos(θ) Y
Scaling
Zoom In Zoom Out
(Enlarge (Reduce
Scaling) Scaling)
Scaling
• X’ = X.Sx
• Y’= Y.Sy
• The above equation can be written in matrix form as:
X’ Sx 0 X
Y’ = 0 Sy 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
Shear
X-Direction Shear Y-Direction Shear
A transformation that slants the shape of an object is called the shear
transformation. There are two shear transformations X-Shear and Y-Shear. One
shifts X coordinates values and other shifts Y coordinate values. However; in
both the cases only one coordinate changes its coordinates and other preserves
its values. Shearing is also termed as Skewing.
Shear
• X-Direction Shear
X’ = X + Shx*Y
Y’ = Y
X’ 1 Shx X
Y’
= 0 1 Y
• Y-Direction Shear
X’ = X
Y’ = X*Shy + Y
X’ = 1 0 X
Y’ Shy 1 Y
Reflection
-1 0 Y-Axis
0 1
(-X, Y) (X, Y)
X-Axis
(-X, -Y) (X, -Y)
-1 0 1 0
0 -1
0 -1
Reflection
Y-Axis
0 -1 0 1
-1 0 1 0
Y = -X Y=X
(Y, X)
(-Y, -X)
(X, Y) (X, Y)
X-Axis
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.
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)
Homogeneous Coordinates
• Translation
X’ 1 0 tx X
Y’ = 0 1 ty Y
1 0 0 1 1
• Rotation
X’ Cos(θ) -Sin(θ) 0 X
Y’ = Sin(θ) Cos(θ) 0 Y
1 0 0 1 1
Homogeneous Coordinates
• Scaling
X’ Sx 0 0 X
Y’ = 0 Sy 0 Y
1 0 0 1 1
• Shear in X-Direction
X’ 1 Shx 0 X
Y’ = 0 1 0 Y
1 0 0 1 1
Homogeneous Coordinates
• Shear in Y-Direction
X’ 1 0 0 X
Y’ = Shy 1 0 Y
1 0 0 1 1
• Reflection (X- Axis as Mirror)
X’ 1 0 0 X
Y’ = 0 -1 0 Y
1 0 0 1 1
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
1 0 0 1 1
Inverse Transformations
• Inverse Rotation
X’ Cos(-θ) -Sin(-θ) 0 X
Y’ = Sin(-θ) Cos(-θ) 0 Y
1 0 0 1 1
• Inverse Scaling
X’ 1/Sx 0 0 X
Y’ = 0 1/Sy 0 Y
1 0 0 1 1
• The inverse reflection matrix is same as reflection
matrix.
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.
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 X-
axis.
• 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.
3-D Geometric Transformation
• Translation
X’ 1 0 0 tx X
Y’ 0 1 0 ty Y
=
Z’ 0 0 1 tz Z
1 0 0 0 1 1
• Scaling
X’ Sx 0 0 0 X
Y’ = 0 Sy 0 0 Y
Z’ 0 0 Sz 0 Z
1 0 0 0 1 1
3-D Geometric Transformation
• Rotation about X-axis
X’ 1 0 0 0 X
Y’ 0 Cos(θ) -Sin(θ) 0 Y
=
Z’ 0 Sin(θ) Cos(θ) 0 Z
1 0 0 0 1 1
• Rotation about Y-axis
X’ Cos(θ) 0 Sin(θ) 0 X
Y’ = 0 1 0 0 Y
Z’ -Sin(θ) 0 Cos(θ) 0 Z
1 0 0 0 1 1
3-D Geometric Transformation
• Rotation about Z-axis
X’ Cos(θ) -Sin(θ) 0 0 X
Y’ = Sin(θ) Cos(θ) 0 0 Y
Z’ 0 0 1 0 Z
1 0 0 0 1 1
Types of Coordinate System
In cad three types of coordinate systems are needed in order to
input, store and display model geometry and graphics.
Those are:
1. The model coordinate system (MCS) or world coordinate or
global coordinate system (GCS).
2. The user coordinate system (UCS) and local coordinate
system (LCS) or working coordinate system (WCS).
3. The screen coordinate system (SCS).
World Coordinate (or) Global Coordinate (or) Model Coordinate System
The world coordinate system is standard coordinate system about which
software store information of geometric models.
It is reference Cartesian co-ordinate space of the model with respect to
which all the models geometrical data is stored.
However, the user will have flexibility of inputting the data in other
coordinate systems as well such as polar or spherical coordinate system.
This is the only coordinate system that a modeling
software recognizes when storing or retrieving the
graphical information from model data base.
The origin of MCS can be arbitrary chosen by the user.
WORKING OR USER COORDINATE SYSTEM (WCS)
* If the geometric model has a complex
geometry or a specific orientation, it is highly
inconvenient to input the graphical data in a
model coordinate system, In such cases for
the convenience of graphical data input, the
coordinate system defined with respect to
the model and is known as user coordinate
system.
* This coordinate system is defined by the
user for the convenience of input of graphical
information
Screen Coordinate System (Or) Display Coordinate System (SCS)
In contrast to the MCS and UCS the Screen
Coordinate System is defined as a two
dimensional device-dependent coordinate
system whose origin is usually located at
the lower left corner of the graphics
display.
A transformation operation from MCS
coordinates to SCS coordinates is performed
by the software before displaying the model
views and graphics
Geometric Mapping
• In CAD modeling, the user inputs the graphical information or 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 and the graphical description of model
from one coordinate system to another without changing the position,
orientation, size and shape of model.
Difference between Geometric
Transformation and Geometric Mapping
Transformation Mapping
• Geometric transformation changes • Geometric mapping changes the
the position, orientation, size and or graphical description of the graphics
shape of graphic element within the element from one coordinate system to
same coordinate system. another without changing it’s position,
orientation and size or shape.
• This involves changes in • This involve change in coordinate
graphics element in same coordinate system of same graphic element.
system.
• This involve one graphics element • This involve one graphics element
and one coordinate system. and 2 coordinate system.
Types of Geometric Mapping
• Translational Mapping
• Rotational Mapping
• General Mapping
Translational Mapping
Y
1 0 tx
0 1 ty
0 0 1
ty
Y’
tx
X’
If The axes of the two coordinate systems(original and new) are parallel, then the
mapping is translational mapping.
Rotational Mapping
If the two coordinate system ( original and new ) have common origin but the axes are at
an angle, then the mapping is rotational mapping.
Cos(α) -Sin(α) 0
Y Y’ P
Sin(α) Cos(α) 0
X
0 0 1
Y
Y*Cos(α)
X
Y α
X
X*Sin(α)
α
Y*Sin(α)
X’
X*Cos(α)
General Mapping
It is the combination of rotational and translational mapping.
Y
X
Y’
α
tx
ty
Cos(α) -Sin(α) tx
Sin(α) Cos(α) ty
X’
0 0 1
ORTHOGRAPHIC PROJECTION
The simplest of the Parallel projections is the orthographic projection, commonly used for
engineering drawings. They accurately show the correct or true size and shape of single plane face
of an object. orthographic projections are projections onto one of the coordinate planes x=0, y=0,
z=0.The matrix for projection onto the z plane is
Notice that the third column (the z column) is all zeros. Consequently, the effect of the
transformation is to set the z coordinate of a position vector to zero.
Similarly, the matrices for projection on to x=0 and y=0 planes are