PRODUCT LIFE CYCLE
ME5351 COMPUTER AIDED DESIGN
PRODUCT CYCLE
ME5351 COMPUTER AIDED DESIGN
DESIGN PROCESS
• Engineering Design process is a series of steps
that engineers follow to come up with a solution
to a problem.
ME5351 COMPUTER AIDED DESIGN
COMPUTER AIDED DESIGN
• CAD is the use of computers to aid in the
creation, modification, analysis, or
optimization of a design.
• CAD software is used to increase the
productivity of the designer, improve the
quality of design, improve communications
through documentation, and to create a
database for manufacturing.
ME5351 COMPUTER AIDED DESIGN
COMPUTER AIDED DESIGN
GEOMETRIC MODELLING
• The physical design is defined on the computer by the designer using software's like
Solid works, Catia, Creo, Fusion 360.
• Geometric Models – Solid model, Surface model, Wire frame model
ENGINEERING ANALYSIS
• Any engineering design requires some types of mathematical analysis.
• For mechanical design – Stress-Strain calculations, Heat transfer computations, Modes
of vibrational behavior.
• Mass Properties can be determined – Mass, Volume, Centroid, Moment of inertia.
DESIGN REVIEW & EVALUATION
• Inference Checking – ADAMS Software – Simulate the kinematics of various linkage.
• Layering Technique – Used to review the machinating allowance.
COMPUTER AIDED DRAFTING – Presentation of design in the form of drawings.
• Dimensioning, Tolerancing, Hatching, Enlargement of details, Sectional views
ME5351 COMPUTER AIDED DESIGN
SEQUENTIAL VS CONCURRENT ENGINEERING
OVER THE WALL APPROACH
TEAM COLLABORATION
ME5351 COMPUTER AIDED DESIGN
ME5351 COMPUTER AIDED DESIGN
CAD SYSTEM ARCHITECTURE
Operating System
Application
Database Software
CAD model
Graphics Utility User
• Working data
Interface
• Geometry
• Drawings
• Standards Device Drivers
• Library Data
• Component
Model
• Manufacturing
Input – Output Devices
ME5351 COMPUTER AIDED DESIGN
CAD SYSTEM ARCHITECTURE
ME5351 COMPUTER AIDED DESIGN
CAD SYSTEM ARCHITECTURE
ME5351 COMPUTER AIDED DESIGN
COMPUTER GRAPHICS
Computer graphics is the discipline of generating images with the aid of computers.
ME5351 COMPUTER AIDED DESIGN
GEOMETRIC TRANSFORMATION
• With the help of computer graphics, the alterations can be easily done to the
drawing.
• The graphic image(Drawing) has a database created for it.
• This database can be modified by mathematical operations called
Transformations.
• Transformations make use of the data stored in the frame buffer.
• Modification of this data results in modification in display.
• Translation – It involves moving an element from one location to another
• Rotation – Used to create entities arranged in circular arrays. (Circular Pattern)
• Scaling – It alters the size of an object
• Reflection – Used to mirror the object.
• Shear – This transformation causes the image to slant.
ME5351 COMPUTER AIDED DESIGN
REPRESENTATION OF A POINT
POINT
• P = [X, Y]
LINE
𝑃1 𝑋1 𝑌1
L= =
𝑃2 𝑋2 𝑌2
CARTESIAN COORDINATE SYSTEM POLAR COORDINATE SYSTEM
ME5351 COMPUTER AIDED DESIGN
TRANSLATION - GEOMETRIC TRANSFORMATION
• When every entity of a
geometric model remains
parallel to its initial position,
the transformation is called
translation.
• To translate a point by a
distance tx in X direction & ty in
Y direction, a translation matrix
T is added to the original
matrix.
ME5351 COMPUTER AIDED DESIGN
ROTATION - GEOMETRIC TRANSFORMATION
• It is a transformation, & a variation of
it can also used to create entities
arranged in circular arrays.
• This rotation is occurs about the origin
• By creating the entity once & then
rotating / copying it to the desired
positions on the circumference.
• Circular pattern.
Point = P = [X Y]
• P = [r cosФ r sinФ]
After rotation
P’ = [X’ Y’] = [r cos(θ+Ф) r sin (θ+Ф)]
P’ = [r (cosθ cosФ – sinθ sinФ) r (sinθ cosФ + cosθ sinФ)]
P’ = [ (X cosθ – Y sinθ) (X sinθ + Y cosθ)]
𝑐𝑜𝑠θ 𝑠𝑖𝑛θ 𝒄𝒐𝒔θ 𝒔𝒊𝒏θ
P’ = [X Y] R=
−𝑠𝑖𝑛θ 𝑐𝑜𝑠θ −𝒔𝒊𝒏θ 𝒄𝒐𝒔θ
ME5351 COMPUTER AIDED DESIGN
SCALING - GEOMETRIC TRANSFORMATION
• This transformation alters the size of an object.
• This scaling is occurs about the origin.
• Point = P = [X Y]
𝑺𝒙 𝟎
• After Scaling, Point = P’ = P . S, [X’ Y’] = [X Y]
𝟎 𝑺𝒚
• Sx – Scale factor in X direction, Sy – Scale factor in Y direction
ME5351 COMPUTER AIDED DESIGN
SHEARING - GEOMETRIC TRANSFORMATION
• This transformation causes the image to slant.
• Y shear preserves all the X coordinates values but shifts Y value.
• X shear preserves all the Y coordinates values but shifts X value.
• Point = P = [X Y] • Point = P = [X Y]
• After X-Shearing, • After Y-Shearing,
• Point = P’ = P . SH, • Point = P’ = P . SH,
𝟏 𝟎 𝟏 𝒂
• [X’ Y’] = [X Y] • [X’ Y’] = [X Y]
𝒃 𝟏 𝟎 𝟏
ME5351 COMPUTER AIDED DESIGN
REFLECTION - GEOMETRIC TRANSFORMATION
• Reflection is the same as obtaining a mirror of the original shape.
• Used in most engineered products, Products are symmetrical.
• Point = P = [X Y] After Reflection, Point = P’ = P . M,
ME5351 COMPUTER AIDED DESIGN
HOMOGENEOUS COORDINATES
• Translation transformation is in the form of vector addition, other
transformations are in the form of multiplications.
• In certain applications, multiple operations are required. (Include Translation)
• In such cases it is convenient to represent transformations as matrix
multiplications.
• This drawback can be eliminated by Homogeneous coordinates.
• The use of homogeneous coordinate system is vital when there are multiple
operations which include translation, as in this coordinate system, translation
is also represented as a multiplication.
• Point P = [X Y], can be expressed as P = [X’ Y’ h]
• h – Non-zero number, Value for h = 1.
• The general transformation matrix is also modified to a 3×3 matrix.
ME5351 COMPUTER AIDED DESIGN
HOMOGENEOUS TRANSFORMATION MATRIX
ME5351 COMPUTER AIDED DESIGN
CONCATENATION OR COMPOSITE TRANSFORMATIONS
• Task - Rotation about any arbitrary given point
Sequence
• Translate the object such that rotation point coincides with the origin.
• Rotate about the origin
• Translate again back to original rotation point
ME5351 COMPUTER AIDED DESIGN
CONCATENATION OR COMPOSITE TRANSFORMATIONS
• Task – Scaling about any arbitrary point.
Sequence
• Translate the object such that the desired fixed scaling point coincides with the origin.
• Scaling the object about the origin
• Translate the object again back to original fixed scaling point.
ME5351 COMPUTER AIDED DESIGN
CONCATENATION OR COMPOSITE TRANSFORMATIONS
Task – Reflection about any given line Y = mx + b
• Translate the line & object such that the line passes through the origin
• Rotate the line & the object about the origin such that the line coincides with any one
axis of the coordinate system
• Reflect about the coinciding axis
• Apply inverse Rotation
• Apply inverse Translation
ME5351 COMPUTER AIDED DESIGN
INVERSE TRANSFORMATIONS
• Transformation modify each point of the entity (X,Y) to (X’,Y’)
• In many cases, we need to undo the effect of transformations.
• Undoing the transformations, from (X’,Y’) to (X,Y). It is another transformation. This
is determined by matrix inversion.
T . T -1 = I
• T – Transformation Matrix
INVERSE TRANSLATION
1 0 0 1 0 0
Inv 0 1 0 = 0 1 0
𝑡𝑥 𝑡𝑦 1 −𝑡𝑥 −𝑡𝑦 1
INVERSE ROTATION
𝑐𝑜𝑠θ 𝑠𝑖𝑛θ 0 𝑐𝑜𝑠(−θ) 𝑠𝑖𝑛(−θ) 0
Inv −𝑠𝑖𝑛θ 𝑐𝑜𝑠θ 0 = −𝑠𝑖𝑛(−θ) 𝑐𝑜𝑠(−θ) 0
0 0 1 0 0 1
INVERSE SCALING
𝑆𝑥 0 0 1/𝑆𝑥 0 0
Inv 0 𝑆𝑦 0 = 0 1/𝑆𝑦 0
0 0 1 0 0 1
ME5351 COMPUTER AIDED DESIGN
CONCATENATION OR COMPOSITE
TRANSFORMATIONS
• Matrix multiplication is not cumulative. A . B ≠ B . A
• Matrix multiplication is associative. For three matrices A, B & C.
A . B . C = (A . B) . C = A . (B . C)
• It is observed that most of the transformations, besides translation
are of the form A,
A= Translational Matrix, T =
Matrix multiplication between these two matrices,
A.T= =
ME5351 COMPUTER AIDED DESIGN
A Rectangle is formed by four points ABCD whose coordinates are :
A(50,50), B(100,50), C(100,80), D(50,80). Calculate the new
coordinates of the rectangle in reduced size using the scaling factors
SX = 0.5 and SY = 0.6
• ABCD = Homogeneous Coordinates, ABCD =
𝑆𝑋 0 0 0.5 0 0
• SX = 0.5 and SY = 0.6, Scaling Matrix, S = 0 𝑆𝑌 0 = 0 0.6 0
0 0 1 0 0 1
•After Scaling, A’B’C’D’ = ABCD . S = .
• A’B’C’D’ =
•The new coordinates are A’(25,30), B’(50,30), C’(50,48), D’(25,48).
ME5351 COMPUTER AIDED DESIGN
A Triangle PQR has its vertices at P(0,0), Q(4,0) and R(2,3). It is to be
translated by 4 units in X direction and 2 units in Y direction, then it is to
be rotated in anticlockwise direction about the new position of point R
through 90 degree. Find the new position of the triangle.
𝟎 𝟎 0 0 1
• Δ PQR = 𝟒 𝟎 , Homogeneous Coordinates, Δ PQR = 4 0 1
𝟐 𝟑 2 3 1
1 0 0
• Translation tx = 4, ty = 2, Translation Matrix = 0 1 0
4 2 1
0 0 1 1 0 0 4 2 1
• Δ P’Q’R’ = Δ PQR . T = 4 0 1 . 0 1 0 = 8 2 1
2 3 1 4 2 1 6 5 1
• Rotated in anti-clockwise direction about the new point R’(6,5) through 90°
• R’ – not a origin point, Rotation can be from the origin, So we need to move the R’ point
to origin first (Translation), then complete the rotation transformation. At last do the the
inverse translation.
• Δ P”Q”R” = Δ P’Q’R’ . T . R . T-1
ME5351 COMPUTER AIDED DESIGN
A Triangle PQR has its vertices at P(0,0), Q(4,0) and R(2,3). It is to be
translated by 4 units in X direction and 2 units in Y direction, then it
is to be rotated in anticlockwise direction about the new position of
point R through 90 degree. Find the new position of the triangle.
• Δ P”Q”R” = Δ P’Q’R’ . T . R . T-1
4 2 1 1 0 0 cos 90 sin 90 0 1 0 0
• = 8 2 1 . 0 1 0 . − sin 90 cos 90 0 . 0 1 0
6 5 1 −6 −5 1 0 0 1 6 5 1
4 2 1 1 0 0 0 1 0 1 0 0
• = 8 2 1 . 0 1 0 . −1 0 0 . 0 1 0
6 5 1 −6 −5 1 0 0 1 6 5 1
4 2 1 1 0 0 0 1 0
• = 8 2 1 . 0 1 0 . −1 0 0
6 5 1 −6 −5 1 6 5 1
4 2 1 0 1 0 9 3 1
• = 8 2 1 . −1 0 0 = . 9 7 1
6 5 1 11 −1 1 6 5 1
• New vertices are P”(9,3), Q”(9,7), R”(6,5)
ME5351 COMPUTER AIDED DESIGN
Consider a triangle ABC having coordinates A(5,5), B(8,5) and C(5,10).
Determine the new vertex positions if ;
a). The triangle is rotated by 60° anticlockwise about the vertex A.
b). The triangle is scaled by 2 times in X direction & 3 times in y
direction about vertex A.
c). If it is mirrored about a line Y = 2X + 4
Δ ABC = Homogeneous Coordinates, Δ ABC =
TRIANGLE ROTATED BY +60°(ANTI-CLOCKWISE) ABOUT A(5,5)
Δ A’B’C’ = Δ ABC . T . R . T-1
5 5 1 1 0 0 cos 60 sin 60 0 1 0 0
= 8 5 1 . 0 1 0 . − sin 60 cos 60 0 . 0 1 0
5 10 1 −5 −5 1 0 0 1 5 5 1
5 5 1 1 0 0 0.5 0.866 0
= 8 5 1 . 0 1 0 . −0.866 0.5 0
5 10 1 −5 −5 1 5 5 1
5 5 1 0.5 0.866 0 5 5 1
= 8 5 1 . −0.866 0.5 0 = 6.5 7.598 1
5 10 1 6.83 −1.83 1 0.67 7.5 1
New Vertices A’(5,5), B’(6.5,7.598), C’(0.67,7.5)
ME5351 COMPUTER AIDED DESIGN
Consider a triangle ABC having coordinates A(5,5), B(8,5) and C(5,10).
Determine the new vertex positions if ;
a). The triangle is rotated by 60° anticlockwise about the vertex A.
b). The triangle is scaled by 2 times in X direction & 3 times in y
direction about vertex A.
c). If it is mirrored about a line Y = 2X + 4
TRIANGLE SCALED, SX = 2, SY = 3 ABOUT A(5,5)
Δ A’B’C’ = Δ ABC . T . S . T-1
5 5 1 1 0 0 2 0 0 1 0 0
= 8 5 1 . 0 1 0 . 0 3 0 . 0 1 0
5 10 1 −5 −5 1 0 0 1 5 5 1
5 5 1 1 0 0 2 0 0
= 8 5 1 . 0 1 0 . 0 3 0
5 10 1 −5 −5 1 5 5 1
5 5 1 2 0 0 5 5 1
= 8 5 1 . 0 3 0 = 11 5 1
5 10 1 −5 −10 1 5 20 1
New Vertices A’(5,5), B’(11,5), C’(5,20)
REFLECTION ABOUT LINE Y = 2X + 4
m = Slope = tan θ = 2, θ = tan-1(2) = 63.435°
Δ A’B’C’ = Δ ABC . T . R . M . R-1 . T-1
ME5351 COMPUTER AIDED DESIGN
Consider a triangle ABC having coordinates A(5,5), B(8,5) and C(5,10).
Determine the new vertex positions if ;
a). The triangle is rotated by 60° anticlockwise about the vertex A.
b). The triangle is scaled by 2 times in X direction & 3 times in y
direction about vertex A.
c). If it is mirrored about a line Y = 2X + 4
REFLECTION ABOUT LINE Y = 2X + 4
Δ A’B’C’ = Δ ABC . T . R . M . R-1 . T-1
5 5 1 1 0 0 cos(−63.4) sin(−63.4) 0 1 0 0 cos(63.4) sin(63.4) 0 1 0 0
= 8 5 1 . 0 1 0 . − sin(−63.4) cos(−63.4) 0 . 0 −1 0 . − sin(63.4) cos(63.4) 0 . 0 1 0
5 10 1 0 −4 1 0 0 1 0 0 1 0 0 1 0 4 1
5 5 1 1 0 0 0.448 −0.894 0 1 0 0 0.448 0.894 0 1 0 0
= 8 5 1 . 0 1 0 . 0.894 0.448 0 . 0 −1 0 . −0.894 0.448 0 . 0 1 0
5 10 1 0 −4 1 0 0 1 0 0 1 0 0 1 0 4 1
5 5 1 1 0 0 0.448 −0.894 0 1 0 0 0.448 0.894 0 1 0 0
= 8 5 1 . 0 1 0 . 0.894 0.448 0 . 0 −1 0 . −0.894 0.448 0. 0 1 0
5 10 1 0 −4 1 0 0 1 0 0 1 0 0 1 0 4 1
5 5 1 1 0 0 0.448 −0.894 0 1 0 0 0.448 0.894 0
= 8 5 1 . 0 1 0 . 0.894 0.448 0 . 0 −1 0 . −0.894 0.448 0
5 10 1 0 −4 1 0 0 1 0 0 1 0 4 1
5 5 1 1 0 0 0.448 −0.894 0 0.448 0.894 0 −𝟐. 𝟐 𝟖. 𝟔 𝟏
= 8 5 1 . 0 1 0 . 0.894 0.448 0 . 0.894 −0.448 0 = −𝟒 𝟏𝟏 𝟏
5 10 1 0 −4 1 0 0 1 0 4 1 𝟏. 𝟖 𝟏𝟏. 𝟔 𝟏
New Vertices A’(-2.2,8.6), B’(-4,11), C’(1.8,11.6)
ME5351 COMPUTER AIDED DESIGN
ME5351 COMPUTER AIDED DESIGN
ME5351 COMPUTER AIDED DESIGN
ME5351 COMPUTER AIDED DESIGN
ME5351 COMPUTER AIDED DESIGN
WINDOW PORT VIEW PORT
• World coordinate area selected for • Device coordinate area selected for
display. display
• What is to be viewed? • Where is to be viewed?
• Region created according to the • Region created according to the
world coordinates device coordinates
• Helps to determine the section of • Helps to determine the section of
the scene to be displayed. the scene to be displayed.
• An area on a display device to
which a window is mapped.
ME5351 COMPUTER AIDED DESIGN
VIEW PORT
ME5351 COMPUTER AIDED DESIGN
CLIPPING
• Clipping is the process of determining the visible portions of a drawing lying
within a window.
POINT CLIPPING
Assume a point P(x, y) does not
satisfy the following conditions will be
clipped away
Xwmin ≤ X ≤ Xwmax
Ywmin ≤ Y ≤ Ywmax
LINE CLIPPING
• Line that do not intersect the clipping
window are either completely inside the
window or completely outside the window.
• This method used to
• Save the line segment
• Discard the line segment
TBRL code – Bit code • Divide the line according to window
Bit 4 Bit 3 Bit 2 Bit 1 coordinate
Top Bottom Right Left
ME5351 COMPUTER AIDED DESIGN
COHEN–SUTHERLAND ALGORITHM
Step 1 : Assign a region code for two
endpoints of given line.
Step 2 : If both endpoints have a region code
0000 then given line is completely inside.
Step 3 : Else, perform the logical AND
operation for both region codes.
Step 3.1 : If the result is not 0000, then given
line is completely outside. Region code P1 & P2 = 0000
Visible
Step 3.2 : Else line is partially inside.
Step 3.2.1 : Choose an endpoint of the line Any line having 1 in the same bit
that is outside the given rectangle. position in the region code for
Step 3.2.2 : Find the intersection point of the each end point – Invisible –
rectangular boundary (based on region code). Outside clipping triangle (P6 & P5)
Step 3.2.3 : Replace endpoint with the
intersection point and update the region code.
Step 3.2.4 : Repeat step 2 until we find a
clipped line either trivially accepted or trivially
rejected.
Step 4 : Repeat step 1 for other lines
ME5351 COMPUTER AIDED DESIGN
COHEN–SUTHERLAND ALGORITHM
Consider the window size from 5 to 9. Clip the following line
Line P1(4,12) to P2(8,8)
• Region code for P1 1001(outside)
• Region code for P2 0000(Inside)
• AND operation P1+P2 = 0000
• S0, Line is partially inside the window.
• P1 is outside, So calculate new value for P1
• X1 = 4, Y1 = 12, X2 = 8, Y2 = 8
𝑌2 −𝑌1 8 −12
• m= = =-1
𝑋2 −𝑋1 8 −4
• Line intersect with Xwmin
• Find Y
• Y = Y1 + m (X2 – X1)
• Here X = Xwmin = 5
• Y = 12 + (-1) (5 – 4) = 12 – 1 = 11
• New Point P1(X, Y) = (5, 11)
ME5351 COMPUTER AIDED DESIGN
COHEN–SUTHERLAND ALGORITHM
New Point P1 (5,11)
• Xwmin ≤ X ≤ Xwmax, Xwmin ≤ 5 ≤ Xwmax
• Ywmin ≤ Y ≤ Ywmax, Ywmin ≤ 11 ≤ Ywmax
Conditions fails,
Apply algorithm once again
New Line is from (5, 11) to (8, 8)
• X1 = 5, Y1 = 11, X2 = 8, Y2 = 8
𝑌2 −𝑌1 8 −11
• m= = =-1
𝑋2 −𝑋1 8−5
• Line intersect with Ywmax = 9
• Find X
(𝑌 −𝑌1) (9 −11)
• X = X1 + 𝑚 = 5 + −1 = 5 + 2 =7
• New Point P1(X, Y) = (7, 9) The main draw back of this
• Xwmin ≤ X ≤ Xwmax, Xwmin ≤ 7 ≤ Xwmax algorithm is to clip a single line, we
have to do the same algorithm twice
• Ywmin ≤ Y ≤ Ywmax, Ywmin ≤ 9 ≤ Ywmax
• Conditions Accepted, New line segment (7,9) to (8,8)
ME5351 COMPUTER AIDED DESIGN
DDA LINE ALGORITHM
• Y= mx + C, where m=slope, C= Y-intercept.
• Identify the points: (X1,Y1, X2, Y2)
Δy 𝑦 −𝑦
• Slope, m = Δx = 𝑥2 −𝑥1 ;
2 1
• Find the Number of steps:
• If ΔY>ΔX, Number of steps = ΔY
• If ΔX>ΔY, Number of steps = ΔX
• Condition 1: If m < 1, assume ΔX=1
• Xi +1 = Xi + 1, Yi +1 = Yi + m
• where (i= 1,2,3…….n)
• Note: While plotting points “X” will be incremented by 1
• and “Y” has to be rounded off to nearest integer.
ΔX ΔY
Xincrement = , Yincrement =
𝑵𝒐 𝒐𝒇 𝒔𝒕𝒆𝒑𝒔 𝑵𝒐 𝒐𝒇 𝒔𝒕𝒆𝒑𝒔
• Condition 2: If m >1, assume ΔY=1
• Yi +1=Yi + 1, Xi+1= Xi+(1/m) where (i= 1,2,3……. n)
Note: While plotting points “Y” will be incremented by 1 and “X” has to be rounded off
to nearest integer.
ME5351 COMPUTER AIDED DESIGN
m<1
DDA LINE ALGORITHM
m>1
• Using DDA Algorithm, • Using DDA Algorithm,
Construct a line for this Construct a line for this
points (X1, Y1) = (5, 4), points (X1, Y1) = (5, 7),
(X2, Y2) = (12, 7) (X2, Y2) = (10, 15)
• ΔX = 12 – 5 = 7 • ΔX = 10 – 5 = 5
X Y Round X Y Round
• ΔY = 7 – 4 = 3
off (Y) • ΔY = 15 – 7 = 8 off (X)
ΔY 3 ΔY 8
• m = ΔX = 7 = 0.4 , 5 4 • m = ΔX = 5 = 1.6 , 5 7
6 4.4 4 5.6 8 6
• Steps = 7 7 4.8 5 6.2 9 6
• Steps = 8
7 8 5.2 5 𝟓 6.8 10 7
Xincrement = 7 = 1 • Xincrement = = 0.6
9 5.6 6 8 7.4 11 7
3 8
Yincrement = 7 = 0.4 10 6 6 • Yincrement = =1 8 12 8
8
11 6.4 6 8.6 13 9
12 6.8 7 9.2 14 9
9.8 15 10
ME5351 COMPUTER AIDED DESIGN
m=1
DDA LINE ALGORITHM
m=1
• Using DDA Algorithm, • Using DDA Algorithm,
Construct a line for this Construct a line for this
points (X1, Y1) = (12, 9), points (X1, Y1) = (17, 14),
(X2, Y2) = (17, 14) (X2, Y2) = (12, 9)
• ΔX = 17 – 12 = 5 X Y Round • ΔX = 12 – 17 = - 5
• ΔY = 14 – 9 = 5 off (X) • ΔY = 9 – 14 = - 5
ΔY 5 12 9 ΔY −5
• m = ΔX = 𝟓 = 1 , • m= = =1,
13 10 ΔX −𝟓
X Y Round
14 11 off (X)
• Steps = 5 • Steps = 5
15 12 17 14
5 −5
Xincrement = 5 = 1 16 13 Xincrement = = -1
5 16 13
5 17 14 −5
Yincrement = 5 = 1 Yincrement = = -1 15 12
5
14 11
13 10
12 9
ME5351 COMPUTER AIDED DESIGN
BRESENHAM’S ALGORITHM
• Identify the points: (X1,Y1, X2, Y2)
Δy 𝑦2 −𝑦1
• Slope, m = = ;
Δx 𝑥2 −𝑥1
• Find the Number of steps:
• If ΔY > ΔX, Number of steps = ΔY
• If ΔX > ΔY, Number of steps = ΔX
• Evaluate the Error or Deviation
• ei = 2 ΔY – ΔX
• If ei ≥ 0, ei+1 = ei + 2ΔY – 2ΔX, Xincrement = 𝟏 , Yincrement = 𝟏
• If ei < 0, ei+1 = ei + 2 ΔY, Xincrement = 𝟏 , Yincrement = 𝟎
ME5351 COMPUTER AIDED DESIGN
BRESENHAM’S ALGORITHM
Rasterize the line AB, A(20,10) & B(30,18) using Bresenham’s
Line drawing algorithm e X Y i
• (X1, Y1) = (20, 10), (X2, Y2) = (30,18) 6 20 10
• ΔX = 30 – 20 = 10, ΔY = 18 – 10 = 8
2 21 11
• ΔX > ΔY, Number of steps = ΔX = 10
-2 22 12
• ei = 2 ΔY – ΔX, i = 0, e0 = 2 × 8 – 10 = 6 = e0 ,
14 23 12
• ei ≥ 0, ei+1 = ei + 2ΔY – 2ΔX, Xincrement = 𝟏 , Yincrement = 𝟏,
10 24 13
• e0+1 = e1 = e0 + 2ΔY – 2ΔX = 6 + (2 × 8) – (2 × 10) = 2 = e1 (ei ≥ 0)
6 25 14
• e1+1 = e2 = e1 + (2 × 8) – (2 × 10) = 2 + 16 – 20 = - 2 = e2 (ei < 0)
• ei < 0, ei+1 = ei + 2 ΔY, Xincrement = 𝟏 , Yincrement = 𝟎 2 26 15
• e2+1 = e3 = e2 + 2 ΔY = - 2 + (2 × 8) = 14 = e3 (ei ≥ 0) -2 27 16
• e3+1 = e4 = e3 + (2 × 8) – (2 × 10) = 14 + 16 – 20 = 10 = e4 , (ei ≥ 0) 14 28 16
• e4+1 = e5 = e4 + (2 × 8) – (2 × 10) = 10 + 16 – 20 = 6 = e5 , (ei ≥ 0) 10 29 17
• e5+1 = e6 = e5 + (2 × 8) – (2 × 10) = 6 + 16 – 20 = 2 = e6 , (ei ≥ 0) 30 18
• e6+1 = e7 = e6 + (2 × 8) – (2 × 10) = 2 + 16 – 20 = - 2 = e7 , (ei < 0)
• e7+1 = e8 = e7 + 2 ΔY = - 2 + (2 × 8) = 14 = e8 (ei ≥ 0)
• e8+1 = e9 = e8 + (2 × 8) – (2 × 10) = 14 + 16 – 20 = 10 = e9 , (ei ≥ 0)
ME5351 COMPUTER AIDED DESIGN