0% found this document useful (0 votes)
14 views29 pages

CAD/CAM Course Overview and Objectives

Uploaded by

rupamaha04
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views29 pages

CAD/CAM Course Overview and Objectives

Uploaded by

rupamaha04
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

8/3/2025

SYLLABUS
UNIT I COMPUTER AIDED DESIGN 9 Hours
Product cycle- Design process- sequential and concurrent engineering- Computer aided design – CAD system

ME23004 – CAD/CAM
architecture- Computer graphics – co-ordinate systems- 2D and 3D transformations- homogeneous coordinates-
Line drawing -Clipping- viewing transformation-visual realism.
UNIT II GEOMETRIC MODELLING 9 Hours
Representation of curves- Hermite curve- Bezier curve- B-spline curves-rational curves- Techniques for surface
modeling – surface patch- Coons and bicubic patches- Bezier and B spline surfaces. Solid modeling techniques-
CSG and B-rep – Introduction to model storage –Data structures for interactive modeling- integration of design
analysis and CAD- customization and design automation.
UNIT III CAD STANDARDS and CAD CAM INTERFACE 9 Hours
Graphics and computing standards- Data exchange standards- IGES-STEP – communication standards- current

UNIT I trends in manufacturing engineering- Group technology- design for manufacture and assembly – process
planning techniques – Total approach to product development – techniques of quality engineering – QFD and
FMEA – Taguchi methods –Additive Manufacturing.
COMPUTER AIDED DESIGN UNIT IV COMPUTER NUMERICAL CONTROL
Fundamentals of Numerical control – CNC technology – CNC hardware basics- CNC Tooling and machine
9 Hours

tools- Control systems – CNC Programming – Manual programming – Machining and Turning Centre
Programming - Computer assisted part programming – APT language structure and commands.
UNIT V INFORMATION AND INTEGRATION OF MANUFACTURING SYSTEMS 9 Hours
Information Requirements of Manufacturing - Group Technology and Computer Aided Process Planning-
production planning and control- Integration of Manufacturing Systems: Communications - Material-Handling
Lecture by Systems- Flexible Manufacturing Systems - Computer Aided Quality Control - introduction to Computer
Dr. [Link], M.E., Ph.D. Integrated Manufacturing- Future of CAD/CAM
Assistant Professor/ Mechanical,
TEXT BOOKS:
Anna University, Chennai 1. Groover, M. P., CAD/CAM: Computer-Aided Design and Manufacturing, Pearson Education, 2008.
2

COURSE OBJECTIVES & OUTCOMES


UNIT I - COMPUTER AIDED DESIGN
COURSE OBJECTIVES: Product Cycle
The main learning objectives of this course is to provide knowledge on Geometric
Design Process
modelling and CNC part programming.
Sequential and Concurrent Engineering
COURSE OUTCOMES:
Computer Aided Design
Upon completion of this course, the students will be able to:
CO1 Apply the fundamental concepts of computer graphics and its tools in a CAD System Architecture
generic framework.
CO2 Create and manipulating geometric models using curves, surfaces and solids. Computer Graphics
CO3 Apply standard CAD practices in engineering design and to understand the Co-ordinate Systems
need for integration of CAD and CAM
CO4 Apply CNC manual and computer assisted part programming for various 2D and 3D Transformations
manufacturing process Homogeneous Coordinates
CO5 Discriminate the problems in Production Planning and Control.
Line Drawing
Clipping
Viewing Transformation
3 visual Realism. 4
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

1
8/3/2025

PRODUCT CYCLE PRODUCT CYCLE


• The cycle through which a product goes from development to
retirement is called product life cycle.
• The product cycle starts with developing the product concept, evolving
the design, engineering the product, manufacturing the part,
marketing and servicing.
• The product undergoes the following two main processes
Design process
Manufacturing process

5 6
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

DESIGN PROCESS – Shighely Model DESIGN PROCESS


There are six steps involved in the conventional design process as discussed
below:
1. Recognition of need
• The first step in the designing process is to recognize necessity of that
particular design.
• The condition under which the part is going to operate and the operation of
part in that particular environment.
• The real problem is identified by knowing the history and difficulties faced
in system.

2. Definition of problem
• The design involves type of shape of part, its space requirement, the
material restrictions and the condition under which the part has to operate.
• The basic purpose of design process has to be known before starting the
design.
• A problem may be design of a simple part or complex part.
• It may be problem on optimizing certain parameters.
8
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

2
8/3/2025

DESIGN PROCESS DESIGN PROCESS


3. Synthesis of design 5. Evaluation
• In this, it may be necessary to prepare a rough drawing of design part.
• It is concerned with measuring the design against the specifications established
• The type of loading conditions imposed on the parts. in the problem definition phase.
• The type of shapes which the part section can require and approximate
dimension at which the different forces are located has to be provided on the • The evaluation often requires the fabrication and testing of model to assess
sketch of part. operating performance, quality and reliability.
• The stresses to which the part is likely to be subjected must be analyzed and
relevant formulas should be prepared.
• A mathematical model of design may be prepared to synthesize the parts of 6. Presentation
design. • The design of component must be presented along with necessary drawings in
an attractive format.
4. Analysis and optimization
• The design can be analyzed for the type of loading condition as well as the
geometric shape of the part.
• In the first stage it will be necessary to check the design of the part for safe
stresses.
• If it is not satisfactory, then the dimensions of the part can be recalculated.
• The part can further be optimized for acquiring minimum dimensions, weight,
volume, efficiency of the material and cost.
• The optimization depends on the definition of the problem and importance of a
parameter. Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY
9
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY
10

PRODUCT LIFE CYCLE PRODUCT LIFE CYCLE


1. Introduction
• The product life cycle describes the stages a product goes through from its • When your product is ready for the market, the introduction stage begins.
introduction to the market until its eventual removal. During this stage, you’ll be building your brand and start promoting your
• It typically includes four stages: introduction, growth, maturity, and decline. product. You’ll also be building your customer base, hopefully with the help of
some early adopters that are already fans of your product.
• During the introduction stage of the product development cycle, you’ll also need
to decide the price of your product and establish how you’re going to sell and
distribute the product since you’ll be preparing for the growth stage.

11 12
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

3
8/3/2025

PRODUCT LIFE CYCLE PRODUCT LIFE CYCLE


2. Growth 3. Maturity
• If you’re successful in the introduction stage of your new product development • The maturity stage of the new product development cycle is a stage of stabilization.
cycle your product will start to gain users and you’ll enter the growth stage. At During the maturity stage, the sales of your product will reach its peak and most of
this stage, you can expect to start gaining some profit. your customers are buying the product at this stage.
• During the growth stage of the product development cycle, the demand for your • Your competitors are now reaching the growth stage with their product, and the
product will increase and you need to work hard to keep up with the demand market has more options. The challenge during the maturity stage of the new
and expectations to gain loyal customers. product development cycle is to hold your market position and come up with new
ways to keep your customers happy. If you don’t keep on inventing new things, your
• By the end of the growth stage, you’ll start to have some competitors, who product development cycle will turn to the last, decline stage.
have seen your success and are hoping to duplicate it.

13 14
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

PRODUCT LIFE CYCLE SEQUENTIAL ENGINEERING


4. Decline
• When the maturity stage ends, the inevitable decline stage arrives. You’ll start to
notice a steady drop in sales, and perhaps your customers’ lose interest in your
product or switch to a newer, better product made by a competitor.
• To fight the decline stage of product the development cycle, innovating something
new is key: coming up with improvements to your existing product, or perhaps
making a second generation is a good way to fight the decline and keep up with the
competition.
• If your product has lived its life cycle in the market and is no longer serving its
purpose, discontinuing the product can be a good option.
• In the process planning phase, manufacturing instructions are given based on the
method of manufacturing, decoded in the design phase.
• Activities are carried out one after the other. Each phase/activities there is no
interaction between them.
• Over Wall approach. Because Each department complete work and throw to next
There is no interaction i.e. there is a communication barrier between each
department.

15 16
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

4
8/3/2025

CONCURRENT ENGINEERING Sequential Engineering


Vs Concurrent Engineering
Co-operate work between design and manufacturing and other specialists has to be Sequential Concurrent
Aspect
made. This is known as Concurrent Engineering or Simultaneous Engineering. Engineering Engineering
Linear and step-by- Parallel and
Workflow
step collaborative
Minimal between Continuous across
Communication
stages functions
Development Time Longer Shorter
Error Detection Late in the cycle Early in the process
Design Flexibility Low High

Team Structure Isolated departments Cross-functional teams

Lower due to early


Higher due to late
Cost and Rework detection and
changes
prevention
17
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

COMPUTER AIDED DESIGN COMPUTER AIDED DESIGN


1. Geometric modeling
• Geometric modeling is concerned with the computer compatible mathematical
•Computer‐Aided Design (CAD) is description of the geometry of an object.
the use of computer systems and • The mathematical description allows the image of the object to be displayed and
software to assist in the creation, manipulated on a graphics terminal through signals from the CPU of CAD system.
modification, analysis, and • The software that provides geometric modeling capabilities must be designed for
optimization of a design. efficient use both by the computer and human designer.
•It replaces manual drafting with an • The basic form uses wire frames to represent the object.
automated process, enabling faster, • The most advanced method of geometric modeling is solid modeling in three
more precise, and more flexible dimensions.
design work.
2. Engineering Analysis
• The analysis may involve stress-strain calculations, heat transfer computation etc.
• The analysis of mass properties is the analysis feature of CAD system that has
probably the widest application.
• It provides properties of solid object being analyzed, such as surface area, weight,
volume, center of gravity and moment of inertia.
• The most powerful analysis feature of CAD system is the finite element method.

20
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

5
8/3/2025

COMPUTER AIDED DESIGN COMPUTER AIDED DESIGN


3. Design Review & Analysis Benefits of CAD
• A procedure for design review is interference checking. • Improved engineering productivity
• This involves the analysis of an assembled structure in which there is a risk • Reduced manpower required
that the components of the assembly may occupy same space. • More efficient operation
• Most interesting evaluation features available on some CAD systems is • Customer modification are easier to make
kinematics.
• Low wastages
• The available kinematics packages provide the capabilities to animate the
motion of simple designed mechanisms such as hinged components and • Improved accuracy of design
linkages. • Better design can be evolved
• Saving of materials and machining time by optimization
4. Automated Drafting • Colors can be used to customize the product
• This feature includes automatic dimensioning, generation of crosshatched
areas, scaling of the drawing and the capability to develop sectional views and Limitations of CAD
enlarged views of particular part details. • The system requires large memory and speed.
• The size of the software package is large.
• It requires highly skilled personal to perform the work.
• It has huge investment.
21 22
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

CAD SYSTEM ARCHITECTURE COMPUTER GRAPHICS


1. CAD Hardware
• CPU
• Secondary memory
• Computer Graphics is defined as creation, storage, and manipulation
• Workstation of pictures and drawings by means of a digital computer.
• Input unit
• Output unit • It is an extremely effective medium for communication between people
• Graphics display terminal and computers.
2. CAD Software
• Computer graphics studies the manipulation of visual and geometric
• AutoCAD
• Pro-E
information using computational techniques.
• IDEAS
• Uni-graphics • It focuses on the mathematical and computational foundations of
• CATIA image generation and processing rather than purely aesthetic issues
• Solidworks

3. Data

4. Human knowledge & activities


23 24
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

6
8/3/2025

FUNCTIONS OF GRAPHICS SOFTWARE COORDINATE SYSTEMS


• Create Primitives
– Draw basic shapes: points, lines, curves, surfaces, solids. The right-handed Cartesian coordinate system is used for defining
• Build Models
the geometry of the parts. In order to specify the geometry of a given
– Wireframe, surface, or solid representations of parts and assemblies.
• Move & Transform solid, it is necessary to use a variety of coordinate systems.
– Translate, rotate, scale objects in 2D/3D space.
• Set Up Views They are the following:
– Define camera position, choose orthographic vs. perspective, map to screen.
• Clip & Cull 1. User/Local Coordinate System
– Discard anything outside the viewing window or hidden from view.
2. World Coordinate System
• Draw Pixels
– Convert lines and polygons into screen pixels (rasterization). 3. Display/Screen Coordinates
• Resolve Visibility
– Decide which surfaces or edges are front-most (depth buffering).
• Shade & Light
– Apply lighting models and interpolate colors for smooth appearance.
• Apply Textures
– Wrap images or patterns onto surfaces for detail without extra geometry.
• Render & Export
– Produce the final image or model file in common formats (PNG, STL, STEP).
25 26
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

1. World Coordinate System 2. User Coordinate System


• This refers to the actual coordinate system used as • The default coordinate system when the user starts
a master for the component. the modelling is the WCS.

• Sometimes, it may also be called the model • However, sometimes it becomes difficult to define
coordinate system. certain geometries if they are to be defined from the
WCS.
• Figure shows the component with its associated
world coordinate system, X, Y and Z. This is • In such cases, alternate coordinate systems can be
basically the coordinate system in which the part defined relative to the WCS. These coordinate
database is stored. systems are termed User Coordinate Systems
(UCS) or working coordinate systems.
• However, the user will also have the flexibility of
inputting the data in other coordinate systems as • For example, in Fig. X’, Y’, Z’ is the user coordinate
well such as polar coordinates or spherical system defined for modelling the slot. Similarly,
coordinates. there can be other UCS that could be defined
depending upon the geometry.
• The software before it stores the data will actually
convert this information into the Cartesian • This reduces the modelling complexity. The UCS
system. can be defined by shifting the origin only as shown
in Fig. or by combining the origin with the
orientation of the axes as well.
27 28
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

7
8/3/2025

3. Display Coordinate System GEOMETRIC TRANSFORMATION


• This refers to the actual coordinates to be used for • Transformations are a fundamental part of the computer graphics.
displaying the image on the screen. • Transformations are the movement of the object in Cartesian plane.
• It may also be termed the screen coordinate • Transformation are used to position objects, to shape object, to change viewing
system. positions, and even how something is viewed.

• The actual screen coordinates relate to the pixels


TYPES OF TRANSFORMATION
to determine whether the actual values of the
There are two types of transformation in computer graphics.
screen or the virtual image that can be displayed
1) 2D transformation
are needed to help in the image display.
2) 3D transformation
• The virtual size will be larger than the actual
pixels of the screen resolution. TYPES OF 2D AND 3D TRANSFORMATIONS
a) Translation - Repositioning
b) Rotation – Viewing different angles
c) Scaling – Increase/decrease the size
d) Shearing - Change the shape
e) Reflection - Angle of rotation at 180 deg

29 30
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

2D TRANSFORMATIONS 2D TRANSFORMATIONS
1. Translation 1. Translation
• 2D Translation is a process of moving an object from one • Given a circle C with radius 10 and center coordinates (1, 4). Apply the translation with
position to another in a two dimensional plane. distance 5 in the direction of X axis and 1 in the direction of Y axis. Obtain the new
• Consider a point object O has to be moved from one position to coordinates of C without changing its radius.
another in a 2D plane.
Let- Solution-
• Initial coordinates of the object O = (Xold, Yold) Given-
• New coordinates of the object O after translation = (Xnew, Ynew) •Old center coordinates of C = (Xold, Yold) = (1, 4)
• Translation vector or Shift vector = (Tx, Ty) •Translation vector = (Tx, Ty) = (5, 1)
•Let the new center coordinates of C = (Xnew, Ynew).
Given a Translation vector (Tx, Ty)-
• Tx defines the distance the Xold coordinate has to be moved. •Applying the translation equations, we have-
• Ty defines the distance the Yold coordinate has to be moved. Xnew = Xold + Tx = 1 + 5 = 6
• This translation is achieved by adding the translation Ynew = Yold + Ty = 4 + 1 = 5
coordinates to the old coordinates of the object as-
•Thus, New center coordinates of C = (6, 5).
Xnew = Xold + Tx (This denotes translation towards X axis)
Ynew = Yold + Ty (This denotes translation towards Y axis)

In Matrix form, the above translation equations may be


represented as-
31 32
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

8
8/3/2025

2. Rotation 2. Rotation
• 2D Rotation is a process of rotating an object with respect to an angle in a two
dimensional plane. Problem:
• Consider a point object O has to be rotated from one angle to another in a 2D plane. Given a line segment with starting point as (0, 0) and ending point as (4, 4). Apply
Let- 30 degree rotation anticlockwise direction on the line segment and find out the new
• Initial coordinates of the object O = (Xold, Yold) coordinates of the line.
• Initial angle of the object O with respect to origin = Φ
• Rotation angle = θ Solution
• New coordinates of the object O after rotation = (Xnew, Ynew) We rotate a straight line by its end points with the same angle. Then, we re-draw a
Xold = rcosϕ.................................................(1) line between the new end points.
Yold = rsinϕ..................................................(2)
• Same way we can represent the point O’ (Xnew, Ynew) as −
Given
Xnew = rcos(ϕ+θ) = rcosϕcosθ−rsinϕsinθ.......(3)
Old ending coordinates of the line = (Xold, Yold) = (4, 4)
Ynew = rsin(ϕ+θ) = rcosϕsinθ+rsinϕcosθ.......(4)
Rotation angle = θ = 30º
• This rotation is achieved by using the following rotation equations-
Xnew = Xold . cosθ – Yold . sinθ
Ynew = Xold . sinθ + Yold . cosθ Let new ending coordinates of the line after rotation = (Xnew, Ynew).
• In Matrix form, the above rotation equations may be represented as-

33 34
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

2. Rotation 3. Scaling
Applying the rotation equations, we have- • Scaling may be used to increase or reduce the size of object.
Xnew = Xold x cosθ – Yold x sinθ • Scaling subjects the coordinate points of the original object to change.
= 4 x cos30º – 4 x sin30º • Scaling factor determines whether the object size is to be increased or reduced.
= 4 x (√3 / 2) – 4 x (1 / 2) If scaling factor > 1, then the object size is increased.
= 2√3 – 2 If scaling factor < 1, then the object size is reduced.
= 2(√3 – 1)
= 2(1.73 – 1) Consider a point object O has to be scaled in a 2D plane.
= 1.46 Let-
• Initial coordinates of the object O = (Xold, Yold)
• Scaling factor for X-axis = Sx
Ynew = Xold x sinθ + Yold x cosθ
• Scaling factor for Y-axis = Sy
= 4 x sin30º + 4 x cos30º • New coordinates of the object O after scaling = (Xnew, Ynew)
= 4 x (1 / 2) + 4 x (√3 / 2) • This scaling is achieved by using the following
= 2 + 2√3 scaling equations-
= 2(1 + √3) Xnew = Xold . Sx
= 2(1 + 1.73) Ynew = Yold . Sy
= 5.46 In Matrix form, the above scaling equations may be represented as-
Thus, New ending coordinates of the line after rotation = (1.46, 5.46).

35 36
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

9
8/3/2025

3. Scaling 3. Scaling
Problem For Coordinates B(3, 3)
Given a square object with coordinate points A(0, 3), B(3, 3), C(3, 0), D(0, 0).
Apply the scaling parameter 2 towards X axis and 3 towards Y axis and obtain the Let the new coordinates of corner B after scaling = (Xnew, Ynew).
new coordinates of the object.
Applying the scaling equations, we have-
Solution Xnew = Xold . Sx = 3 x 2 = 6
Given Ynew = Yold . Sy = 3 x 3 = 9
Old corner coordinates of the square = A (0, 3), B(3, 3), C(3, 0), D(0, 0)
Scaling factor along X axis = 2 Thus, New coordinates of corner B after scaling = (6, 9).
Scaling factor along Y axis = 3
For Coordinates C(3, 0)
For Coordinates A(0, 3)
Let the new coordinates of corner C after scaling = (Xnew, Ynew).
Let the new coordinates of corner A after scaling = (Xnew, Ynew).
Applying the scaling equations, we have-
Applying the scaling equations, we have- Xnew = Xold . Sx = 3 x 2 = 6
Xnew = Xold . Sx = 0 x 2 = 0 Ynew = Yold . Sy = 0 x 3 = 0
Ynew = Yold . Sy = 3 x 3 = 9
Thus, New coordinates of corner C after scaling = (6, 0).
Thus, New coordinates of corner A after scaling = (0, 9). 37 38
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

3. Scaling 4. Reflection
For Coordinates D(0, 0) • Reflection is a kind of rotation where the angle of rotation is 180 degree.
• The reflected object is always formed on the other side of mirror.
Let the new coordinates of corner D after scaling = (Xnew, Ynew). • The size of reflected object is same as the size of original object.

Applying the scaling equations, we have- Consider a point object O has to be reflected in a 2D plane. Let-
Xnew = Xold . Sx = 0 x 2 = 0 • Initial coordinates of the object O = (Xold, Yold)
Ynew = Yold . Sy = 0 x 3 = 0 • New coordinates of the reflected object O after reflection = (Xnew, Ynew)

Thus, New coordinates of corner D after scaling = (0, 0). Reflection On X-Axis:
This reflection is achieved by using the following reflection equations-
Xnew = Xold
Thus, New coordinates of the square after scaling = A (0, 9), B(6, 9), C(6, 0), D(0, 0).
Ynew = -Yold
In Matrix form, the above reflection equations may be represented as-

39 40
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

10
8/3/2025

4. Reflection 4. Reflection
Reflection On Y-Axis: Problem
Given a triangle with coordinate points A(3, 4), B(6, 4), C(5, 6). Apply the
This reflection is achieved by using the following reflection equations- reflection on the X axis and obtain the new coordinates of the object.
Xnew = -Xold
Ynew = Yold Solution-
Given-
In Matrix form, the above reflection equations may be represented as- •Old corner coordinates of the triangle = A (3, 4), B(6, 4), C(5, 6)
•Reflection has to be taken on the X axis

For Coordinates A(3, 4)


Let the new coordinates of corner A after reflection = (Xnew, Ynew).

Applying the reflection equations, we have-


Xnew = Xold = 3
Ynew = -Yold = -4

Thus, New coordinates of corner A after reflection = (3, -4).

41 42
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

4. Reflection 5. Shear
For Coordinates B(6, 4)
• 2D Shearing is an ideal technique to change the shape of an existing object in a
Let the new coordinates of corner B after reflection = (Xnew,
two dimensional plane.
Ynew).
Applying the reflection equations, we have- • In a two dimensional plane, the object size can be changed along X direction as
Xnew = Xold = 6 well as Y direction.
Ynew = -Yold = -4 • So, there are two versions of shearing-
1. Shearing in X direction
Thus, New coordinates of corner B after reflection = (6, -4). 2. Shearing in Y direction

For Coordinates C(5, 6) Consider a point object O has to be sheared in a 2D plane.


Let the new coordinates of corner C after reflection
= (Xnew, Ynew). Let-
Applying the reflection equations, we have-
•Initial coordinates of the object O = (Xold, Yold)
Xnew = Xold = 5
Ynew = -Yold = -6 •Shearing parameter towards X direction = Shx
Thus, New coordinates of corner C after reflection = (5, -6).
•Shearing parameter towards Y direction = Shy
Thus, New coordinates of the triangle after reflection, •New coordinates of the object O after shearing = (Xnew, Ynew)
= A (3, -4), B(6, -4), C(5, -6).

43 44
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

11
8/3/2025

5. Shear 5. Shear
Shearing in X Axis
• A transformation that slants the shape of an object is called the shear
transformation. The X-Shear preserves the Y coordinate and changes are made to X
• There are two shear transformations X-Shear and Y-Shear. coordinates, which causes the vertical lines to tilt right or left.
• One shifts X coordinates values and other shifts Y coordinate values. However; Xnew = Xold + Shx . Yold
in both the cases only one coordinate changes its coordinates and other Ynew = Yold
preserves its values. Shearing is also termed as Skewing. In Matrix form, the above shearing equations may be represented as-

45 46
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

5. Shear 5. Shear
Shearing in Y Axis Shearing in XY Axis

The Y-Shear preserves the X coordinates and changes the Y coordinates which The Y-Shear preserves the X coordinates and changes the Y coordinates which
causes the horizontal lines to transform into lines which slopes up or down. causes the horizontal lines to transform into lines which slopes up or down.
Xnew = Xold Xnew = Xold + Shx . Yold
Ynew = Yold + Shy . Xold Ynew = Yold + Shy . Xold
In Matrix form, the above shearing equations may be represented as- In Matrix form, the above shearing equations may be represented as-

47 48
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

12
8/3/2025

5. Shear 5. Shear
Problem For Coordinates B(0, 0)
Given a triangle with points (1, 1), (0, 0) and (1, 0). Apply shear parameter 2 on X Let the new coordinates of corner B after shearing = (Xnew, Ynew).
axis and 2 on Y axis and find out the new coordinates of the object.
Applying the shearing equations, we have-
Solution- Xnew = Xold + Shx . Yold = 0 + 2 x 0 = 0
Given- Ynew = Yold = 0
Old corner coordinates of the triangle = A (1, 1), B(0, 0), C(1, 0)
•Shearing parameter towards X direction (Shx) = 2 Thus, New coordinates of corner B after shearing = (0, 0).
•Shearing parameter towards Y direction (Shy) = 2
For Coordinates C(1, 0)
Shearing in X Axis- Let the new coordinates of corner C after shearing = (Xnew, Ynew).

For Coordinates A(1, 1) Applying the shearing equations, we have-


Let the new coordinates of corner A after shearing = (Xnew, Ynew). Xnew = Xold + Shx . Yold = 1 + 2 x 0 = 1
Ynew = Yold = 0
Applying the shearing equations, we have-
Xnew = Xold + Shx . Yold = 1 + 2 x 1 = 3 Thus, New coordinates of corner C after shearing = (1, 0).
Ynew = Yold = 1 Thus, New coordinates of the triangle after shearing in X axis = A (3, 1), B(0, 0),
C(1, 0).
Thus, New coordinates of corner A after shearing = (3, 1). 49 50
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

5. Shear 5. Shear
Shearing in Y Axis- • For Coordinates C(1, 0)
• Let the new coordinates of corner C after
For Coordinates A(1, 1) shearing = (Xnew, Ynew).
Let the new coordinates of corner A after shearing = (Xnew, Ynew).
• Applying the shearing equations, we
Applying the shearing equations, we have- have-
Xnew = Xold = 1 • Xnew = Xold = 1
Ynew = Yold + Shy . Xold = 1 + 2 x 1 = 3 • Ynew = Yold + Shy . Xold = 0 + 2 x 1 = 2

Thus, New coordinates of corner A after shearing = (1, 3). • Thus, New coordinates of corner C after
shearing = (1, 2).
For Coordinates B(0, 0) • Thus, New coordinates of the triangle
Let the new coordinates of corner B after shearing = (Xnew, Ynew). after shearing in Y axis = A (1, 3), B(0,
0), C(1, 2).
Applying the shearing equations, we have-
Xnew = Xold = 0
Ynew = Yold + Shy . Xold = 0 + 2 x 0 = 0

Thus, New coordinates of corner B after shearing = (0, 0).


51 52
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

13
8/3/2025

HOMOGENEOUS COORDINATES HOMOGENEOUS COORDINATES -


1. TRANSLATION
• Being homogeneous means a uniform representation of rotation, translation, This translation is achieved by adding the
scaling and other transformations. translation coordinates to the old coordinates of
• Homogeneous coordinates are widely used in computer graphics because they the object as-
enable effective, simple manipulations of transformations in a specific way. •Xnew = Xold + Tx (This denotes translation towards
X axis)
• We have to use 3×3 transformation matrix instead of 2×2 transformation •Ynew = Yold + Ty (This denotes translation towards
matrix. Y axis)
• To convert a 2×2 matrix to 3×3 matrix, we have to add an extra dummy
In Matrix form, the above translation equations
coordinate W. may be represented as-
• In this way, we can represent the point by 3 numbers instead of 2 numbers,
which is called Homogenous Coordinate system.
•The homogeneous coordinates representation of
• In this system, we can represent all the transformation equations in matrix (X, Y) is (X, Y, 1).
multiplication. Any Cartesian point P(X, Y) can be converted to homogenous •Through this representation, all the
coordinates by P’ (Xh, Yh, h). transformations can be performed using matrix /
vector multiplications.
• Homogeneous coordinates are generally used in design and construction • The above translation matrix may be represented
applications. as a 3 x 3 matrix as-

53 54
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

HOMOGENEOUS COORDINATES HOMOGENEOUS COORDINATES


2. ROTATION 3. SCALING
This rotation is achieved by using the following
rotation equations- This scaling is achieved by using the
Xnew = Xold . cosθ – Yold . sinθ following scaling equations-
Ynew = Xold . sinθ + Yold . cosθ Xnew = Xold . Sx
Ynew = Yold . Sy
In Matrix form, the above rotation equations
may be represented as-

For homogeneous coordinates, the above rotation For homogeneous coordinates, the above
matrix may be represented as a 3 x 3 matrix as- scaling matrix may be represented as a 3 x 3
matrix as-

55 56
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

14
8/3/2025

HOMOGENEOUS COORDINATES HOMOGENEOUS COORDINATES


4. REFLECTION 4. REFLECTION

This reflection is achieved by using the This reflection is achieved by using the
following reflection equations- following reflection equations-
Xnew = Xold Xnew = -Xold
Ynew = -Yold Ynew = Yold

In Matrix form, the above reflection In Matrix form, the above reflection
equations may be represented as- equations may be represented as-

For homogeneous coordinates, the above scaling For homogeneous coordinates, the above scaling
matrix may be represented as a 3 x 3 matrix as- matrix may be represented as a 3 x 3 matrix as-

57 58
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

HOMOGENEOUS COORDINATES HOMOGENEOUS COORDINATES


5. SHEARING 5. SHEARING

Shearing in X Axis- Shearing in Y Axis-

Shearing in X axis is achieved by using the Shearing in Y axis is achieved by using the
following shearing equations- following shearing equations-
Xnew = Xold + Shx . Yold Xnew = Xold
Ynew = Yold Ynew = Yold + Shy . Xold

In Matrix form, the above shearing In Matrix form, the above shearing
equations may be represented as- equations may be represented as-

For homogeneous coordinates, the above


For homogeneous coordinates, the above scaling matrix may be represented as a 3 x 3 matrix scaling matrix may be represented as a 3 x
as- 3 matrix as-

59 60
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

15
8/3/2025

3D TRANSFORMATIONS 1. 3D Translation
3D Translation is a process of moving an object from one position to another in a
• When the transformation takes place on a 3D plane, it is called 3D
three dimensional plane
transformation.
• The translation, scaling and rotation transformations used for 2D can be This translation is achieved by adding the
extended to three dimensions. translation coordinates to the old coordinates of
the object as-
• In 3D, each transformation is represented by a 4x4 matrix. •Xnew = Xold + Tx (This denotes translation
• Using homogeneous coordinates it is possible to represent each type of towards X axis)
transformation in a matrix form and integrate transformations into one matrix. •Ynew = Yold + Ty (This denotes translation
towards Y axis)
• To apply transformations, simply multiply matrices, also easier in hardware •Znew = Zold + Tz (This denotes translation
and software implementation. towards Z axis)
• Homogeneous coordinates can represent directions.
• Homogeneous coordinates: 4 components
• Transformation matrices: 4×4 elements

61 62
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY 62

2. 3D Rotation 3. 3D Scaling
3D Rotation is a process of rotating an object with respect to an angle in a three
dimensional plane. 3D Scaling is a process of modifying or altering the size of objects.

For X-Axis Rotation


This scaling is achieved by using the following scaling
This rotation is achieved by using the
following rotation equations-
equations-
Xnew = Xold Xnew = Xold x Sx
Ynew = Yold x cosθ – Zold x sinθ Ynew = Yold x Sy
Znew = Yold x sinθ + Zold x cosθ Znew = Zold x Sz

For Y-Axis Rotation


This rotation is achieved by using the
following rotation equations-
Xnew = Zold x sinθ + Xold x cosθ
Ynew = Yold
Znew = Yold x cosθ – Xold x sinθ

For Z-Axis Rotation


This rotation is achieved by using the
following rotation equations-
Xnew = Xold x cosθ – Yold x sinθ
Ynew = Xold x sinθ + Yold x cosθ
Znew = Zold 63 64
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY 63 Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

16
8/3/2025

4. 3D Reflection 5. 3D Shearing
3D Reflection is a kind of rotation at 180 degree. The reflected object is formed on the other side of 3D Shearing is an ideal technique to change the shape of an existing object in a three
mirror. The size of reflected object is same size.
dimensional plane.
Reflection Relative to XY Plane:
This reflection is achieved by using the Shearing in X Axis-
following reflection equations- Shearing in X axis is achieved by using the following
Xnew = Xold shearing equations-
Ynew = Yold Xnew = Xold
Znew = -Zold Ynew = Yold + Shy . Xold
Znew = Zold + Shz . Xold
Reflection Relative to YZ Plane:
This reflection is achieved by using the Shearing in Y Axis-
following reflection equations- Shearing in Y axis is achieved by using the following
Xnew = -Xold shearing equations-
Ynew = Yold Xnew = Xold + Shx . Yold
Znew = Zold Ynew = Yold
Znew = Zold + Shz . Yold
Reflection Relative to XZ Plane:
This reflection is achieved by using the Shearing in Z Axis-
following reflection equations- Shearing in Z axis is achieved by using the following
Xnew = Xold shearing equations-
Ynew = -Yold Xnew = Xold + Shx . Zold
Znew = Zold Ynew = Yold + Shy . Zold
65 Znew = Zold 66
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY 65 Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY 66

COMPOSITE TRANSFORMATIONS LINE DRAWING


• As the name suggests itself Composition, here we combine two or more transformations
into one single transformation that is equivalent to the transformations that are performed • Line drawing is the process of displaying a straight line between two
one after one over a 2-D object. points on a computer screen or any pixel-based display.
• A composite transformation is a sequence of transformations; one followed by the other.
In a matrix, any sequence of transformations as a composite transformation matrix by • Since screens are made up of tiny pixels arranged in a grid, drawing a
calculating the matrix product of the individual transformations. perfect straight line (which is continuous) requires deciding which pixels
• For example, If a transformation of the plane T1 is followed by a second plane to turn on to best approximate that line.
transformation T2, then the result represented by a single transformation T which is the
composition of T1 and T2 is written as T = T1∙T2. • Why Line Drawing Matters
• A combined matrix − [T][X] = [X] [T1] [T2] [T3] [T4] …. [Tn] Lines are used to:
• Draw shapes (like polygons and wireframes)
• Define edges of 3D models
• Create charts, graphs, and diagrams
• Construct computer-aided design (CAD) systems

67 68
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

17
8/3/2025

LINE DRAWING 1. DDA LINE GENERATION ALGORITHM


Common Algorithms for Line Drawing: • DDA stands for Digital Differential Analyzer, which works by calculating the
1. DDA (Digital Differential Analyzer) Line Drawing Algorithm intermediate points required to draw a line between two points on the screen.
• Incrementally calculates intermediate points between the start and end
points using the slope. DDA Algorithm
• Uses floating-point operations. The DDA algorithm is particularly suitable when we need to draw lines on
• Steps through one axis (usually x) and calculates corresponding y raster displays. Raster graphics represent images using pixels, so each point
values. on the screen corresponds to a pixel. The DDA algorithm helps in drawing
straight lines between two endpoints by calculating intermediate pixel values.
2. Bresenham Line Drawing Algorithm
• Uses only integer addition, subtraction, and bit shifting, which makes
it faster and more efficient.
• Decides the closest pixel to the theoretical line at each step.
• Widely used in computer graphics because of its speed and accuracy.

69 70
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

1. DDA LINE GENERATION ALGORITHM 1. DDA LINE GENERATION ALGORITHM


The steps involved in DDA line generation algorithm are: Let us see the pseudocode −
1. Input the two end points of the line segment, (x1,y1) and (x2,y2). Algorithm DDA_Line(x1, y1, x2, y2)
Input: Starting point (x1, y1) and ending point (x2, y2)
2. Calculate the difference between the x-coordinates and y-coordinates of the end
Output: Points along the line
points as dx and dy respectively.
Calculate dx and dy
3. Calculate the slope of the line as m dx = x2 - x1
dy = y2 - y1
If m>1 xn = x1 +1/m (x moves with deviation) yn = y1+1 (y changes in unit interval) Determine the number of steps
steps = maximum of |dx| and |dy|
If m<1 xn = x1 +1 (x changes in unit interval) yn = y1+m (y moves with deviation) Calculate increment in x and y for each step
If m=1 xn = x1 (with unit interval) yn = y1 (with unit interval) xinc = dx / steps
yinc = dy / steps
Initialize starting point
4. Set the initial point of the line as (x1,y1).
x = x1
5. Loop through the x-coordinates of the line, incrementing by one each time, and y = y1
calculate the corresponding y-coordinate using the equation. For i = 0 to steps,
6. Plot the pixel at the calculated (x,y) coordinate. Plot point (round(x), round(y))
7. Repeat steps 5 and 6 until the endpoint (x2,y2) is reached. x = x + xinc
y = y + yinc
End
71 72
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

18
8/3/2025

1. DDA LINE GENERATION ALGORITHM 1. DDA LINE GENERATION ALGORITHM

EXAMPLE: Draw A line between the points (20,10) and (30,18)

Step 1: x1 = 20, y1 = 10, x2 =30, y2 = 18.

Step 2: dx = 30 -20 = 10, dy = 18 – 10 = 8.

Step 3: Slope m= dy/dx = 8/10 = 0.8 <1

Step 4: x increment = 1, y increment = 0.8.

Step 5: x1= 20, y1 = 10.

x1= 20+1, y1 = 10+0.8.

Step 6: pixel (21,11)

Step 7: x = x + x increment. y = y + y increment.

73 74
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

2. BRESENHAM'S LINE GENERATION


1. DDA LINE GENERATION ALGORITHM
ALGORITHM
Advantages of the DDA Algorithm What is Bresenham's Line Algorithm?
• Simplicity: Easy to understand and implement. Bresenham's algorithm is used to draw a straight line between two points
• Efficiency for gentle slopes: Works well when the slope of the line is less on a discrete grid (like pixels on a computer screen). It determines which
than or equal to 1. points on the grid should be plotted to form a close approximation of the
• Smooth lines: Uses floating-point arithmetic to calculate intermediate line.
points, resulting in smoother lines.
• Incremental calculations: The algorithm calculates pixel positions step- Why use Bresenham's Algorithm?
by-step, making it systematic and straightforward. • It uses only integer addition, subtraction, and bit shifting, no floating
Disadvantages of the DDA Algorithm point operations, making it very fast.
• It produces a line that looks continuous and smooth on the pixel grid.
• Floating-point operations: Relies on floating-point arithmetic, which can
be slower on some hardware compared to integer arithmetic. • Ideal for raster displays.
• Rounding errors: Requires rounding of calculated positions to pixel
coordinates, which can introduce small inaccuracies.
• Potential cumulative error: Over long lines, these small rounding errors
may accumulate, causing minor deviations.
75 76
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

19
8/3/2025

2. BRESENHAM'S LINE GENERATION 2. BRESENHAM'S LINE GENERATION


ALGORITHM ALGORITHM
Calculate the points between the starting coordinates (3, 2) and ending
•Step-by-Step Algorithm coordinates (17, 5).
•Input the two endpoints of the line. Save the left endpoint as (x0, y0).
Solution-
•Plot the first point (x0, y0).
•First, let's calculate our initial values −
•Calculate the constants Δx, Δy, 2Δy, and (2Δy - 2Δx).
Δx = 17 - 3 = 14
•Calculate the initial decision parameter: pk= 2Δy - Δx
Δy = 5 - 2 = 3
•For each xk along the line, starting with k = 0:
• If pk < 0, plot (xk+1, yk) and set pk+1= pk + 2Δy Slope, m = Δy / Δx = 3/14 (slope of the line)
xn =x1+1 2Δy =2*3 = 6
yn = y1 2Δy - 2Δx = 6-28 = -22

• If pk > 0, plot (xk+1, yk+1) and set pk+1 = pk + 2Δy - 2Δx


xn =x1+1
•Initial decision parameter pk= 2Δy - Δx = 2(3) - 14 = -8
yn = y1+1 •If pk < 0, plot (xk+1, yk) and set pk+1= pk + 2Δy
•If pk > 0, plot (xk+1, yk+1) and set pk+1 = pk + 2Δy - 2Δx
•Repeat step 5 until you reach the end point.
77 78
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

2. BRESENHAM'S LINE GENERATION 2. BRESENHAM'S LINE GENERATION


ALGORITHM ALGORITHM
Plot
Step x y p Decision Factor Formula pk
Point
0 3 2 -8 pk<0 pk+6 (4, 2) -2
1 4 2 -2 pk<0 pk+6 (5, 2) 4
2 5 2 4 pk>0 pk-22 (6, 3) -18
3 6 3 -18 pk<0 pk+6 (7, 3) -12
4 7 3 -12 pk<0 pk+6 (8, 3) -6
5 8 3 -6 pk>0 pk+6 (9, 3) 0
6 9 3 0 pk<0 pk-22 (10, 4) -22
7 10 4 -22 pk<0 pk+6 (11, 4) -16
8 11 4 -16 pk>0 pk-22 (12, 4) -10
9 12 4 -10 pk>0 pk-22 (13, 4) -4
10 13 4 -4 pk<0 pk+6 (14, 4) 2
11 14 4 2 pk>0 pk-22 (15, 5) -20
12 15 5 -20 pk>0 pk-22 (16, 5) -14
13 16 5 -14 pk<0 pk+6 (17, 5) End

79 80
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

20
8/3/2025

2. BRESENHAM'S LINE GENERATION CLIPPING


ALGORITHM
• Clipping in computer graphics refers to removing objects or parts of objects
Advantages of Bresenham's Line Drawing Algorithm
outside of the visible area of a computer screen or viewport.
• Simplicity − The algorithm is easy to understand and implement.
• Efficiency − It uses only integer arithmetic, making it fast. • The viewing window (or viewport) often has a limited display area. Moreover,
• Versatility − We can use it to draw lines in any direction. when rendering complex scenes, it’s essential to optimize performance by
discarding objects or parts of objects that viewers can’t see.
• Hardware Implementation − It is suitable for hardware implementation due
to its use of simple arithmetic operations. • Clipping : a process that divides each element of the picture into

Disadvantages of Bresenham's Line Drawing Algorithm 1 Visible portions.


2 Invisible portions.
• Limited Smoothness − The resulting line may not be as smooth as desired,
allowing the invisible portion to be discarded.
especially for short lines.
• Fixed Line Thickness − The algorithm only draws one-pixel-thick lines.

81 82
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

CLIPPING CLIPPING
Types of Clipping,

1. Point Clipping
2. Line Clipping
3. Polygon/Area Clipping
4. Text Clipping

83 84
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

21
8/3/2025

1. Point Clipping 2. Line Clipping


• In this algorithm, we are given 9 regions on the screen. Out of which one
region is of the window and the rest 8 regions are around it given by 4 digit
binary. The division of the regions are based on (x_max, y_max) and (x_min,
y_min).
• The central part is the viewing region or window, all the lines which lie within
If any of these inequalities is false, it means that the point lies this region are completely visible. A region code is always assigned to the
outside the window, and therefore, it won’t be visible: endpoints of the given line.
• To check whether the line is visible or not.
TBRL which can be defined as top, bottom,
right, and left accordingly.

85 86
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

2. Line Clipping 2. Line Clipping


4) After confirming that the line is partially inside the window, then we find the
intersection with the boundary of the window. By using the following formula:-
Algorithm A B A AND B Slope:- m= (y2-y1)/(x2-x1)
0 0 0 a) If the line passes through top or the line intersects with the top boundary of the
Steps
window. x = x + (y_wmax - y)/m
1) Assign the region codes to both endpoints. 0 1 0
2) Perform OR operation on both of these y = y_wmax
1 0 0 b) If the line passes through the bottom or the line intersects with the bottom
endpoints.
1 1 1 boundary of the window.
Once the codes for each endpoint of a line x = x + (y_wmin - y)/m
are determined, the logical AND operation y = y_wmin
of the codes determines if the line is A B A OR B c) If the line passes through the left region or the line intersects with the left
completely outside of the window. If the
0 0 0 boundary of the window.
logical AND of the endpoint codes is not
zero, the line can be trivally rejected. y = y+ (x_wmin - x)*m
0 1 1 x = x_wmin
•The logical OR of the endpoint codes d) If the line passes through the right region or the line intersects with the right
determines if the line is completely inside 1 0 1
boundary of the window.
the window. If the logical OR is zero, the 1 1 1 y = y + (x_wmax -x)*m
line can be trivally accepted. x = x_wmax
5) Now, overwrite the endpoints with a new one and update it.
87 6) Repeat the 4th step till your line doesn't get completely clipped 88
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

22
8/3/2025

How can Determine The line segment is a candidate for clipping


Cohen-Sutherland Line Clipping
1. Visible: The line segment is visible if both This algorithm is to find the category of
endpoint codes are 0000 the line segment. The algorithm
A = 0000 proceeds in two steps:
B = 0000
[Link] a 4-bit code to each
2. Not visible: The line segment is not visible if endpoint of the line segments.
the logical AND of the codes is not 0000 [Link] The line segment is a
C = 1000 candidate for clipping
D = 1010 AND
------------------------ Note:
= 1000 The code is determined according to
3. Clipping candidate: The line segment is a which of the following nine regions the
candidate for clipping if the logical AND of the endpoints lie in :
endpoint codes is 0000.
E = 0000 X= 0000
F = 0100 AND Z=1000
------------------------
= 0000
89 90
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

Example 1:
How can determine the code for each endpoint?
To find the code for any end point
Starting from the leftmost bit, each bit of the code is set to true(1) orfalse(0)
according to the schema:
1 End point A (0000)
Bit 1 ≡ endpoint is above of the window = sign ( Y – Ymax ) Bit 1 ≡ = sign ( Y – Ymax) = sign ( 3 – 5) = -2 = 0
Bit 2 ≡ endpoint is below of the window = sign ( Ymin –Y ) Bit 2 ≡ = sign ( Ymin -Y) = sign ( 0 – 3) = -3 = 0
Bit 3 ≡ endpoint is right of the window = sign ( X – Xmax) Bit 3 ≡ = sign (X - Xmax) = sign ( 2 – 7) = -5 = 0
Bit 4 ≡ endpoint is left of the window = sign ( Xmin – X ) Bit 4 ≡ = sign ( Xmin - X) = sign ( 0 – 2) = -2 = 0

2 End point B (1000)


Bit 1 ≡ = sign ( 6 – 5) = 1 = 1
Note : Bit 2 ≡ = sign ( 0 - 6) = -6 = 0
sign (a) = 1 if a is positive Bit 3 ≡ = sign (5 – 7 ) = -2 = 0
sign (a) = 0 otherwise. Bit 4 ≡ = sign ( 0 – 5 )= -5 = 0

0000 - Visible
1000 - Invisible

91 92
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

23
8/3/2025

3. Polygon Clipping Sutherland-Hodgman Area Clipping


Polygon : is traditionally a plane figure that is bounded by a finite chain of Polygon clipping is the process of removing certain parts of a polygon that fall
straight line segments closing in a loop to form a closed chain or circuit. outside a specified rectangular boundary. We call this the viewport. The aim is to
We can use polygon clipping to determine which portions of the polygon are display only the part of the polygon that is within the window. Any portion of the
polygon that extends outside the window will be clipped off, ensuring that the
visible to the viewer and to discard any parts of the polygon that are outside of polygon fits neatly inside the viewing area.
the viewing area:

93 94
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

Sutherland-Hodgeman Polygon Clipping 4. Text Clipping


The Sutherland-Hodgman Algorithm clips a polygon one edge at a time. The clipping
process involves four stages:
• Left Clipping − Clipping the parts of the polygon that are outside the left edge
of the window. Text clipping relies on the concept of bounding rectangle
• Right Clipping − Clipping the parts of the polygon that are outside the right
edge of the window.
• Top Clipping − Clipping the parts of the polygon that are outside the top edge TYPES
of the window.
• Bottom Clipping − Clipping the parts of the polygon that are outside the
1. All or None String Clipping
bottom edge of the window. 2. All or None Character Clipping
3. Component Character Clipping

95 96
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

24
8/3/2025

4. Text Clipping 4. Text Clipping


1. All or None String Clipping 2. All or None Character Clipping
In the All and None String Clipping method is the simplest method. Here The All and None Character Clipping method works at the character level
the entire string of text is either accepted or rejected based on whether it instead of the string level. In this method, each individual character in the
fits entirely inside the clipping window. If the entire string is inside the string is checked to see if it is fully inside the clipping window. If a
window, it is displayed. However, if any part of the string extends beyond character is entirely inside, it is displayed. However, if a character is
the boundary, the entire string is removed, even if most of it is inside the partially or fully outside the window, it is removed. Unlike string
window. clipping, this method allows some characters of the string to remain
visible while others are clipped.

97 98
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

4. Text Clipping VIEWING TRANSFORMATION


3. Text Clipping
The third method, Text Clipping, is more refined. In this method, only
the part of the character that is inside the window is displayed, while the
portion of the character that is outside the window is clipped. Unlike All
and None Character Clipping, Text Clipping allows part of a character to
be displayed if it crosses the window boundary. This method is
particularly useful when you need a precise rendering of text that is
partially inside the window.

General Terms:
• World coordinate – It is the Cartesian coordinate w.r.t which we define the diagram,
like Xwmin, Xwmax, Ywmin, Ywmax
• Device Coordinate –It is the screen coordinate where the objects are to be displayed,
like Xvmin, Xvmax, Yvmin, Yvmax
• Window –It is the area on the world coordinate selected for display.
• View Port –It is the area on the device coordinate where graphics is to be displayed.

99
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

25
8/3/2025

VIEWING TRANSFORMATION STEPS OF VIEWING TRANSFORMATION


• Viewing Transformation is the process of converting a selected part of a
scene (defined in world coordinates) into a screen display (device
coordinates). It determines what part of the world is seen and how it
appears on the display device.

1. World Coordinates:
• The original coordinate system in which objects are defined.

2. Window:
• A portion of the world coordinates selected for viewing.
• Defines what to display.
• Think of it like a camera frame or zoomed-in area.

3. Viewport:
• A region on the screen or display device where the window contents
are mapped.
• Defines where to display.
• Usually specified in device coordinates (e.g., pixels).
101 102
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

STEPS OF VIEWING TRANSFORMATION VISUAL REALISM


Viewing transformation in computer graphics involves a sequence of steps to • Visual realism is a technique used to interpret image data and create realistic
convert 3D scenes into 2D images for display. pictures from complex multidimensional datasets. It helps make computer-
• It begins with modeling transformation, which positions and orients generated models appear more lifelike by using shading, lighting, and
individual objects using translation, rotation, and scaling to bring them textures.
from object space to world space.
• Next, the world-to-view (camera) transformation places the camera in the • Visualization can be classified into two types: visualization in geometric
scene by defining the eye position, the view reference point, and the up modeling and visualization in scientific computing.
direction, converting world coordinates into viewing coordinates.
• In geometric modeling, it helps designers detect errors or interferences by
• This is followed by the projection transformation, which projects the 3D using different colors, shadows, and transparency. It is also useful in
view onto a 2D plane using either orthographic or perspective projection. identifying quick changes in surface designs.
• After projection, clipping is done to remove parts of objects that lie outside
the view volume, defined by a frustum or a rectangular window. • Scientific computing visualization converts numerical data into visual
images, allowing engineers to view and analyze simulations and results
• The resulting scene is then normalized, mapping the clipped image into a
standardized cube (typically from -1 to 1 or 0 to 1), known as normalized easily. It is an important tool for understanding hidden details in complex
device coordinates (NDC). data during the design process.
• Finally, viewport transformation maps these NDC values to screen
coordinates (pixels), determining where and how the image appears on the
output device. 103 104
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

26
8/3/2025

VISUAL REALISM HIDDEN LINE REMOVAL APPROACH


Depth Algorithm/ Z Algorithm/Priority Algorithm
Techniques:
• Priority algorithm is basis on organization all the polygons in the view according to the
 Projection Methods biggest Z coordinate value of each. If a face intersects more than one face, other visibility
tests besides the Z depth required to solve any issue. This step comprises purposes of
 Hidden Line Removal Approach wrapper. Imagines that objects are modeled with lines and lines are generated where
surfaces join. If only the visible surfaces are created then the invisible lines are
automatically removed.
 Hidden Surface Removal Approach
• ABCD, ADFG, DCEF are given higher priority-1. Hence, all lines in this faces are
 Hidden Solid Removal Approach visible, that is, AB, BC, CD, DA, AD, DF, FG, AG, DC, CE, EF and DF are visible.
AGHB, EFGH, BCEH are given lower priority-2. Hence, all lines in this faces other than
 Shading – given to only visible portion priority-1 are invisible, that is BH, EH and GH. These lines must be eliminated.

 Lighting – clear and better shading representation


 Transparency – detailing of inner portions
 Colouring – based on materials

105 106
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

HIDDEN SURFACE REMOVAL APPROACH HIDDEN SOLID REMOVAL ALGORITHM


Z-buffer Algorithm / Depth Buffer Algorithm Ray-Tracing algorithm
During rasterization the depth/Z value of each pixel (or sample in the case of anti- • Ray tracing is a rendering technique that can realistically simulate the lighting of a
aliasing, but without loss of generality the term pixel is used) is checked against an scene and its objects by rendering physically accurate reflections, refractions, shadows,
existing depth value. If the current pixel is behind the pixel in the Z-buffer, the pixel and indirect lighting. Ray tracing generates computer graphics images by tracing the
is rejected, otherwise it is shaded and its depth value replaces the one in the Z-buffer. path of light from the view camera (which determines your view into the scene),
Z-buffering supports dynamic scenes easily, and is currently implemented efficiently in through the 2D viewing plane (pixel plane), out into the 3D scene, and back to the light
graphics hardware. This is the current standard. The cost of using Z-buffering is that it sources. As it traverses the scene, the light may reflect from one object to another
uses up to 4 bytes per pixel, and that the rasterization algorithm needs to check each (causing reflections), be blocked by objects (causing shadows), or pass through
rasterized sample against the z-buffer. The z-buffer can also suffer from artifacts due to
transparent or semi-transparent objects (causing refractions). All of these interactions
precision errors (also known as z-fighting), although this is far less common now that
commodity hardware supports 24-bit and higher precision buffers. are combined to produce the final color and illumination of a pixel that is then displayed
on the screen. This reverse tracing process of eye/camera to light source is chosen
because it is far more efficient than tracing all light rays emitted from light sources in
multiple directions.
• Another way to think of ray tracing is to look around you, right now. The objects you’re
seeing are illuminated by beams of light. Now turn that around and follow the path of
those beams backwards from your eye to the objects that light interacts with. That’s ray
tracing.
• The primary application of ray tracing is in computer graphics, both non-real-time (film
and television) and real-time (video games). Other applications include those in
architecture, engineering, and lighting design.

107 108
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

27
8/3/2025

HIDDEN SOLID REMOVAL ALGORITHM


Ray-Tracing algorithm
SHADING
• Shading is the process of applying an illumination model to pixels or surfaces
in a graphic to create the illusion of depth by varying light and darkness.

Shading Algorithms

• Flat Shading: Each polygon is shaded with a single


color calculated at its center. This gives a faceted, angular
look without smooth transitions. It is fast to render but
appears unrealistic.

• Gouraud Shading: Calculates lighting at the vertices of a


polygon and then interpolates these colors across the
surface. This creates smooth color transitions and a
more realistic appearance than flat shading, but can miss
highlights inside polygons.

109 110
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

SHADING COLOURING
Colouring is the process of assigning colors to objects or surfaces in a scene to
• Phong Shading: Calculates lighting for every pixel improve their appearance and realism. It helps in distinguishing between
by interpolating surface normals across the polygon different parts of a model, shows lighting effects, and enhances visual
and applying the lighting model per pixel. This understanding of the image.
produces smooth shading with accurate highlights
and more realistic surfaces compared to Gouraud Colours models like:
shading.
• RGB (Red, Green, Blue):
RGB is an additive color model used in digital
displays. Colors are formed by mixing red,
• Halftone Shading: A shading technique that simulates green, and blue light, and combining all
continuous tones using patterns of dots or small three at full intensity produces white. Used
shapes, similar to printing methods. It creates the in digital displays like computer monitors,
illusion of shading by varying the density or size of TVs, smartphones, and cameras.
these dots rather than smooth color gradients.

111 112
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

28
8/3/2025

COLOURING COMPUTER ANIMATION


• CMY (Cyan, Magenta, Yellow): • Computer animation is the process of creating moving images using computer
CMY is commonly used in color printing graphics. It involves displaying a sequence of images, called frames, in quick
(magazines, posters, packaging). It’s a succession to give the illusion of motion.
subtractive color model where colors are • Animations can be 2D (like cartoons) or 3D (used in movies, games, and
created by absorbing (removing) light. simulations). The motion is created by changing the position, shape, size, or
color of objects over time.

Types of Computer Animation


• 2D Animation – Uses flat images and is
• HSV (Hue, Saturation, Value): often used in web animations and
HSV is a color model based on human cartoons.
perception. Hue represents the color type, • 3D Animation – Uses 3D models and is
Saturation indicates color intensity, and widely used in films, video games, and
Value defines brightness. It’s often used for CAD simulations.
animation and gaming for dynamic color • Motion Capture – Real-life movements
changes. are recorded and applied to digital
characters.
113 114
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

APPLICATIONS OF REALISM
 Robot Simulations : Visualization of movement of their links and joints and end
effectors movement etc.
 CNC programs verification of tool movement along the path prescribed and
estimation of cup height and surface finish etc.
 Discrete Even Simulation : Most of DES packages provide the user to create
shop floor environment on the screen to visualize layout of facilities, movement
of material handling systems, performance of machines and tools.
 Scientific Computing : Visualization of results of FEM analysis like iso-stress
and iso-strain regions, deformed shapes and stress contours. Temperature and
heat flux in heat-transfer analysis. Display and animation of mode shape in
vibration analysis.
 Flight Simulation : Cockpit training for pilots is first being provided with flight
simulators, which virtually simulates the surrounding that an actual flight will
pass through.

115
Dr. [Link], M.E., Ph.D. / MECHANICAL/CEG–ANNA UNIVERSITY

29

You might also like