Unit IV Geometric Transformation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Unit IV Geometric Transformation

Introduction, Geometric Transformations, Translation,


Scaling, Rotation, Reflection/Mirror, Shear, Homogeneous
Transformation, Inverse Transformation, Concatenated
Transformation (limited to 2D objects with maximum
3 points only), Coordinate systems - Model (MCS),
Working (WCS), Screen (SCS) coordinate system,
Mapping of coordinate systems, Projections of geometric
models. Orthographic and Perspective projections, Design
and Engineering applications.
Introduction:
• 2D computer graphics is the computer-based generation of digital
images mostly from two-dimensional models (such as 2D
geometric models, text, and digital images) and by techniques
specific to them.
• It facilitates ease in alteration of different images on (graphic
image) drawings which is called as transformation.
• Transformation is a graphical concept of software module used in
CAD CAM that produce the functionality and Interactivity of the
system.
• Geometric transformations move points in space from one location
to another, or they change the description of a point from one
coordinate system, such as a WCS, to another system, such as
MCS.
• In general it can be defined as the change done to the database by
performing certain mathematical operations on it, so as to produce
the desired change in the image.
They are used for following purpose,
• In modelling to express locations of the objects related to others
and to move them around in the modelling space.
• They are used in viewing to generate different views of a model
for visualisation (in different positions and directions) and drafting
purposes.
• They are also used to create animated files of geometric models to
study their motions (using kinematic analysis). Transformation
allows the user to uniformly change the entire picture.
• They are used to obtain different views such as orthographic,
Isometric and perspective etc using different transformation
features viz. translation, rotation, scaling, reflection, mirror etc.
• Commonly used transformation operations are, transformation,
rotation, scaling, reflection / mirror , shear etc.
Formulation
• A point can be represented in matrix form as, P(x,y) = [xp yp]
• Similarly a line with endpoint P1(x1, y1) and P2(x2,y2) can be
represented by,
Translation
• Movement of an entity (image) parallel to its original position.
• If ‘T’ is denoted as translation matrix and tx and ty are the
distances of translation along x and y direction respectively then
new position of translated point can be calculated as,
Rotation
• It is rotating an image in circular array in certain angle to get new
position.
• If ‘R’ is denoted as rotation matrix and  the angle of rotation
about certain axis, then new position of rotation (CW assumed as
negative and CCW is positive) point can be calculated as,
Scaling
• It is enlarging or reducing the size of image in both x and y
direction (uniform) or any one direction (non-uniform) with
certain factor.
• If ‘S’ is denoted as Scaling matrix and sx and sy are the scaling
factor along x and y direction respectively, then
Reflection / Mirror
• It is creation of same / mirror image about certain plane or line.
• If ‘M’ is denoted as reflection matrix then, [P’] = [P][M]
Homogenous Transformation
• The various rigid body transformations discussed so far represents
translation, rotation, scaling and mirroring and shear are in the form of
matrix multiplication.
• but the translation takes the form of vector addition. This makes it
inconvenient to concatenate (combine) transformation involving
translation.
• It is desirable to express all geometric transformations in the form of
matrix multiplications only.
• Representing points by their homogeneous coordinates provides an
effective way to unify the description of geometric transformations as
matrix multiplications.
• Using homogeneous transformations geometric transformations are
customarily embedded into graphic hardware to speed their execution.
• They are also useful for obtaining perspective views of geometric
models, in projective geometry, mechanism analysis and design and
Robotics for development and formulation.
• They remove many anomalous situations encountered in Cartesian
geometry, such as representing points of infinity and non intersections of
parallel lines and greatly simplify expressing rational parametric curves
and surfaces.
Translation Rotation @z axis
Scaling Mirror

Concatenated Transformation
• Concatenated Transformations is used to apply series of transformations in
geometric modelling.
• They are simply obtained by multiplying the [T] matrices of the corresponding
individual transformations. Because matrix multiplication may not be commutative
in all cases, attention must be paid to the order in which transformations are applied
to a given geometric model.
• If we apply n transformations to a point starting with transformation 1, with [T1],
and ending with transformations n, with [Tn], the concatenated transformations of
the given by, P* = [Tn][Tn-1].....[T2][T1]P.
• Concatenation of transformation greatly increases the speed of computation. Without
concatenation, individual transformations would be applied one at a time and the
number of calculations would increase significantly.
• An efficient method of transformation late formulate the transformation matrices,
concat the transformation sequence and then compute transformed coordinates.
• Reflection about any axis y = mx+b
• Translate the line and object such that the line passes through the
origin.
• Rotate the line and the object about the origin such that the Line
coincides with any one axis of the coordinate system (in this cane,
Axis X).
• Reflect about the coinciding axis.
• Apply Inverse Rotation.
• Apply Inverse Translation.
Inverse Transformation:
Comment Original Matrix Inverse Matrix
Inverse of Translation matrix
can be obtained by reversing
the sign of translational
parameters.
Inverse of Rotation matrix can
be obtained by inversing the
angle of rotation.
Inverse of scaling matrix can
be obtained by taking
reciprocal of scaling factor.
Coordinate Systems
Three types of coordinate systems are needed in order to input, store, and display
model geometry and graphics. These are Model Coordinate System (MCS),
Working Coordinate System (WCS), and Screen Coordinate System (SCS),
respectively. Other names for MCS are database, master, or world coordinate
system. Another name for SCS is device coordinate system.
Working Coordinate System
• It is a convenient user-defined system that facilitates geometric
construction.
• It can be established at any position and orientation in space that the user
desires.
• While the user can input data in reference to the WCS, the CAD
software performs the necessary transformations to the MCS before
storing the data.
• The ability to use two separate coordinate systems within the same
model database in relation to one another gives the user great flexibility.
• A WCS requires three noncollinear points to define its XY plane. The
first defines the origin, the first and the second define the X axis, and the
third point with the first defines the V axis.
• The Z axis is determined as the cross product of the two unit vectors in
the directions defined by the lines connecting the first and the second
(the X axis), and the first and the third points (V axis).
Model Coordinate System
• The model coordinate system is defined as the reference space of the
model with respect to which all the model geometrical data is stored.
• It is a Cartesian system which forms the default coordinate system used
by a particular software program.
• The X, Y, and Z axes of the MCS can be displayed on the computer
screen.
• The origin of the MCS cans be arbitrarily chosen by the user while its
orientation is established by the software.
• The three default sketch planes of a CAD/CAM system define the three
planes of the MCS and their intersection point is the MCS origin.
• When a CAD designer begins sketching, the origin becomes a corner
point of the profile being sketched. The sketch plane defines the
orientation of the profile in the model 3D space.
• The MCS is the only coordinate system that the software recognizes
when storing or retrieving graphical information in or from a model
database.
Screen Coordinate System
• In contrast to the MCS and WCS, the screen coordinate system (SCS) is
defined as a 2D device-dependent coordinate system whose origin is
usually located at the lower left corner of the graphics display.
• The physical dimensions of a device screen (aspect ratio) and the type of
device (raster) determine the range of the SCS. The SCS is mostly used
in view-related clicks such as definitions of view origin and window or
clicking a view to select it for graphics operations.
• This SCS is used by the CAD/CAM Software to display relevant
graphics by converting directly from MCS coordinates to SCS (physical
device) coordinates.
• A transformation operation from MCS coordinates to SCS coordinates is
performed by the software before displaying the model views and
graphics. Typically, for a geometric model, there is a data structure to
store its geometric data (relative to MCS), and a display file to store its
display data (relative to SCS).
Mapping of Geometric Models (Coordinate Transformations):
• Mapping is transformation of one coordinate system to other.
• While transformations involve one point and one coordinate
system, mapping involves one point and two coordinate systems.
• Mapping the point changes its description from one coordinate
system to another, but it does not change its location in the
modelling space.
• We input coordinates relative to the coordinate system of the
sketch plane, while CAD software maps the input to the model
MCS coordinates before storing it in the model database.
• It also useful in assembly modelling. Mapping a geometric model,
a collection of points, from one coordinate system to another does
not change its position and orientation with respect to the origins
of both systems. It only changes the description of such position
and orientation.
Translational Mapping:
When the axis of the two coordinate systems is parallel, the mapping
is defined to be translational. As shown in fig. The origins of the
XYZ and X*Y*Z* systems are different but their orientations in
space are the same. The point P described by the vectors P and P* in
the XYZ and X*Y*Z* resp. The vector ‘d’ describes the position of
the origin of the former systems relative to the latter.
Rotational Mapping:
Figure shows the rotational mapping between two coordinate
systems. The two systems share the same origin, and their
orientations are different by the angle . Here it is assumed that the
XY and X*Y* planes are coincident. It is important to realize that the
columns of a rotational matrix [R] can be interpreted to describe the
orientations of a given coordinate system in space.
General Mapping:
As shown in fig the general mapping combines both translational and
rotational mappings. The origins and the orientations of the XYZ and
X*Y*Z* systems are different. In this case, the general mapping
matrix [T] is given by,

Where [R] and d are the rotational and translational mappings parts
of [T], respectively.
Inverse transformations and mappings are useful in both theoretical
and practical aspects of geometric modelling. Using inverse
mappings, a CAD system enables users to display coordinates of
point relative to a given WCS. Transformation modifies each point of
the entity i.e. original matrix to inverse matrix and vice versa.
Projection of Geometric Models
• Projections are use to transform 3D models onto a 2D Projection
plane, as viewing of 3D models is a complex due to the Fact that
display devices are only 2D.
• To obtain the projection of an entity the projection rays (called
projectors) are constructed by connecting the centre of Projection
with each point of the entity.
• The intersections of these projectors with the projection plane
defined the Projected Points which are connected to produce the
projected entity.
• If the Center is at a finite distance from the plane it results in
perspective projection and all the projectors meet at the center.
• if the center is at infinite distance, all the projectors become
parallel (meet at infinity) and result is Parallel projection
geometry.
Orthographic Projection:
• An orthographic projection of a view is obtained by setting a zero
the coordinate value that coincides with the direction of Projection
after the model rotation.
• To obtain the front view, we set z = 0 for all key points of the model.
• For the top view, the model is rotated 90 about the X axis followed
by setting the ‘y’ coordinates of the resulting points to zero. The ‘y’
coordinate is the one to set to zero because the Y axis of the MCS
coincides with the projection direction.
• For the right view can be obtained by rotating the model about the Y
axis by -90 and setting the ‘x’ coordinate to zero. Thus, the
Homogeneous Transformation matrix will be,
Front View Top View Right hand side view
1 0 0 0 1 0 0 0 1 0  1 0 
 0 1 0 0  0 1  1 0 0 1 0 0 
    
 0 0 0 0  0 0 0 0 0 0 0 0 
  0 0 0 1
  
0 0 0 1    0 0 0 1 
Perspective Projections:
• One Common way to obtain a perspective view is to place the
center of the place along the ‘z’ axis of the VCS and project onto
the z=0 or the ‘xy’ plane.
• The center of projection is placed at a distance‘d’ (measured along
the ‘z’ axis) from the projection plane.
• The homogeneous transformation matrix will be, where,‘d’ is the
distance form center of projection to point ‘P’.
1 0 0 0  x
0 1 0 0  y
P=   
0 0 0 0 z
   
0 0  1/ d 1 1 
Numerical:
Points to remember,
• Translation towards right and up considers +ve whereas down and left as –ve.
• Rotation in anticlockwise / CCW is consider as +ve whereas clockwise as –ve.
• For making inverse of translation reverse the sign of translation coordinates, for
inverse of rotation reverse the angle of rotation and for inverse of scaling take
reciprocal of scaling factor.
• Concatenated matrix is combination of more than one transformation matrix as
discussed above.
• While solving numerical of concatenation in case of translation just matrix are
added but in case of other transformation matrix multiplication is involved, which
creates complex operation during concatenation of more than one operation. To
avoid this concept of homogeneous transformation is used. Generally it considered
as 1.
• If in a numerical concatenate operation is asked then combine all the operations to
solve the numerical and if there is no such operation like concatenation then treat
each operations separately.
• If the numerical contains rotation or scaling of entity /image, about any point or line
then during solving the numerical, initially bring the entity coordinate matrix to
initial zero position, then perform the required operation with its matrix form and
finally revert back the image to its original position using matrix as stated above.
A rectangle ABCD with coordinates (50, 50), B (100, 50), C (100, 80) and D (50,
80) has undergone reduction with scaling by 0.5 in ‘x’ and 0.6 in ‘y’ direction.
Calculate the new coordinates of ABCD.
Write a 3 x 3 transformation matrix for the following effects:
1) Scale the image to be twice as large and then translate it 1 unit to the le&
2) Scale the X direction to be half as large and then rotate anticlockwise by 90° about the origin.
3) Rotate anticlockwise about origin by 90° and then scale the X direction by half as large.
4) Translate down 05 unit, right 0.5 unit, and then rotate anticlockwise by 45°.
Write a 3 x 3 transformation matrix for the following effects:
1) Scale the image to be twice as large and then translate it 1 unit to the le&
2) Scale the X direction to be half as large and then rotate anticlockwise by 90° about the origin.
3) Rotate anticlockwise about origin by 90° and then scale the X direction by half as large.
4) Translate down 05 unit, right 0.5 unit, and then rotate anticlockwise by 45°.
A triangle with vertices A (8, 0), B (12, 0) and C (12, 3) has undergone reflection
about line y = 2. Find the concatenated transformation matrix and then find new
coordinates of tingle ABC using this transformation matrix.
Find the concatenate transformation matrix, if the transformations are performed as per the following sequence:
1. Rotation through 45 in anticlockwise direction.
2. Translation through +5 and -8 units along the X and Y directions respectively.
3. Rotation through 60 in clockwise direction.
What is the effect of above transformations on triangle having coordinates A (0, 0), B (10, 0) and C (0, 8).

You might also like