0% found this document useful (0 votes)
6 views

M1

Uploaded by

airtelbaleno
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)
6 views

M1

Uploaded by

airtelbaleno
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
You are on page 1/ 84

BMEE306L

Computer Aided Design and Finite


Element Analysis
Dr. Tapan Kumar Mahanta
School of Mechanical Engineering, VIT
Chennai
Syllabus:
Continued..
Continued..
Continued..
Mark distributions:

Sl.NO Mark distribution Max. Mark Weightage %

1 DA-I 10 10

2 DA-II 10 10

3 DA-III/ Quiz 10 10

4 CAT-I 50 15

5 CAT-II 50 15

6 FAT 100 40
Introduction to CAD:

▪ CAD (Computer Aided Design) is the use of


computer software to design and document a
product’s design process.
▪ Engineering drawing entails the use of
graphical symbols such as points, lines, curves,
planes and shapes. Essentially, it gives
detailed description about any component in
a graphical form.
Background:
▪ Engineering drawings have been in use for
more than 2000 years. However, the use of
orthographic projections was formally
introduced by the French mathematician
Gaspard Monge in the eighteenth century.
▪ Since visual objects transcend languages,
engineering drawings have evolved and
become popular over the years.
CAD stands
for Computer Aided Design
▪ CAD is used to design, develop and optimize
products.
▪ While it is very versatile, CAD is extensively
used in the design of tools and equipment
required in the manufacturing process as well
as in the construction domain.
▪ CAD enables design engineers to layout and to
develop their work on a computer screen,
print and save it for future editing.
Use of CAD:
▪ CAD is used to accomplish preliminary design and
layouts, design details and calculations, creating
3-D models, creating and releasing drawings, as
well as interfacing with analysis, marketing,
manufacturing, and end-user personnel.
▪ CAD facilitates the manufacturing process by
transferring detailed information about a product
in an automated form that can be universally
interpreted by trained personnel.
▪ It can be used to produce either two-dimensional
or three-dimensional diagrams.
Use of CAD:
▪ The use of CAD software tools allow the object to be
viewed from any angle, even from the inside looking out.
▪ One of the main advantages of a CAD drawing is that the
editing is a fast process as compared to manual method.
▪ Apart from detailed engineering of 2D or 3D models, CAD is
widely used from conceptual design and layout of products
to definition of manufacturing of components.
▪ CAD reduces design time by allowing precise simulation
rather than build and test physical prototypes.
▪ CAD is currently widely used for industrial products,
animated movies and other applications.
CAD software enables:
▪ Efficiency in the quality of design.
▪ Increase in the Engineer’s productivity.
▪ Improve record keeping through better
documentation and communication.
Types of CAD Software:
Since its introduction in late 1960’s, CAD
software has improved by leaps and bounds. A
broad classification of CAD is:
• 2D CAD
• 3D CAD
• 3D Wireframe and Surface Modelling
• Solid Modelling
Product Life Cycle
Role of CAD,CAM and PLM process
Daimler is currently road-testing its
prototype NECAR 5 (New Electric Car)
The Product Cycle and CAD/CAM

In order to establish the scope and definition


of CAD/CAM in an engineering environment
and identify existing and future related tools,
a study of a typical product cycle is necessary.
The following Figure shows a flowchart of
such a cycle.

16
Typical Product Life Cycle

The Design Process


Design Collecting
Design definitions, relevant design
needs specifications,
and requirements
information and
feasibility study Synthesis
Analysis The CAD Process
Design Design
Design Design Design Design
documentation and modeling and
evaluation optimization analysis conceptualization
communication simulation

The Manufacturing Process


Production
planning
The CAM Process
Design and
procurement
Process
of new tools Quality Packaging
planning Production Shipping
control
Order
materials

NC, CNC, DNC


programming

Marketing

17
• The product begins with a need which is identified
based on customers' and markets' demands.
• The product goes through two main processes from
the idea conceptualization to the finished product:
1. The design process.
2. The manufacturing process.

The main sub-processes that constitute the design


process are:
1. Synthesis.
2. Analysis.
18
Product goes through two main processes from inception to a
finished product :
- the design and manufacturing process
Design process involves Synthesis and analysis
# Synthesis determines the philosophy, functionality and
uniqueness of the product
# Analysis answers the question ‘What if’, evaluates the
- concept design in the engineering perspective, helps
- to evaluate multiple choices and choose best
- in performance evaluation
- design takes the form of sketches and layout drawings
which shows the relationship among various products
- Finally design documentation in the form of blueprints
CAD Tools Required to Support the Design Process

Design phase Required CAD tools


Design conceptualization Geometric modeling techniques;
Graphics aids; manipulations; and
visualization
Design modeling and simulation Same as above; animation; assemblies;
special modeling packages.
Design analysis Analysis packages; customized
programs and packages.
Design optimization Customized applications; structural
optimization.
Design evaluation Dimensioning; tolerances; BOM; NC.
Design communication and Drafting and detailing…
documentation

20
Manufacturing process begins with process planning
and ends with actual product
Process planning enables
- The most efficient sequence to produce the product
from the design blue print
- Communicate with design team to clarify or request
DCN, design change note to fit manufacturing changes
Outcome
Production plan, tools procurement,material order,
design of jigs and fixtures, inspection gages and
machine programming
Finally, after QA&QC, assembled,packaged and shipped
Implementation of a Typical CAM Process on a
CAD/CAM system

Geometric model Inspection

Interface algorithms
Assembly

Process planning
Packaging

NC programs
To shipping and marketing

22
CAM Tools Required to Support the Design Process
Manufacturing phase Required CAM tools

Process planning CAPP techniques; cost


analysis; material and
tooling specification.
Part programming NC programming

Inspection CAQ; and Inspection


software
Assembly Robotics simulation and
programming

23
Typical Utilization of CAD/CAM Systems in an Industrial Environment

Geometric modeling and graphics package


Process planning
Geometric modeling
of conceptual design CAPP package

Is design evaluation
Yes Are there
No manufacturing
Possible with available discrepancies in CAD
Standard software? databases?
Design
package Yes
Develop customized No
Design testing
programs and
And evaluation packages NC NC
programming package

Programming
No Is final design package
Applicable? Machining

Yes
Inspection
Drafting Inspection
And Robotics
Assembly package
Documentation
24
CAD/CAM System
- an algorithm that requires hardware and software
- Graphic kernels like ACIS is written in C++ and uses a
routine called Schema and is used in Solidworks, UG and
Solid edge
- utilizes a data structure to save the geometry and the
topology of the geometric models
data structure is a well-defined storage scheme that stores
model data
the physical file that stores the model data in the format
offered by the data structure scheme is called database
CAD database is the file that stores the model info.
What does a CAD/CAM algorithm have…

1. Geometric engine – enables users to perform geometric modelling


and construction, editing and manipulation of existing geometry,
drafting and documentation
2. Application module – mass property calculations, assembly analysis,
tolerence analysis, FEA, kinematic simulation, CAM, CAPP, etc
3. Programming module – customising systems by programming them
to fit certain design and manufacturing tasks
4. Communication module – integration within a CAD/CAM system,
other computer systems and manufacturing facilities
5. Collaborative module – enabling concurrent processes through web
technology. Concurrent design happens across geographical
locations.
CAD/CAM systems classification

Low end systems – applications that has less number of components


and whose geometry is not complicated.
Eg. AutoCAD, CADKEY etc

Mid range systems – applications that have complex modelling needs


and can support design and manufacturing applications
Eg. Solidworks, Inventor, MasterCAM

High end systems – legacy systems evolved over the years. Supports
modelling, analysis and manufacturing of complex parts in aero,
automobile and other applications
Eg. CATIA, NX etc
Basic concept of any CAD/CAM Software
1. Approach to execute command..software developer
usually makes it menubased or toolbar based
2. System level customisation..helps change the database
color, drawing properties etc.
3. Document level customisation..units, grid settings etc.
4. Module based customisation..Part modelling, assembly,
drawing,simulation
5. Coordinate systems and sketch planes..used to
input,store and display model geometry and graphics.
• Model coordinate system (MCS), datum,sketch and
construction plates has reference to MCS
• Working coordinate system (WCS), in other words datum or
sketch planes, stores wrt to MCS
• Screen coordiante system (SCS),device dependent
Basic concept of any CAD/CAM Software….
6. 2D operations (Sketching)enabler for part modelling
7. 3D modelling..extrusion, cut, holes,revolve etc.
21/2D models, have uniform cross section and thickness in a direction
perpendicular to the plane of cross section, extrude, revolve
3D models, all other models
8. Heterogenous modelling
9. Viewing..
View orientation, any standard view, front,top,right and isometric
View modes, wireframe,hidden or shaded
View manipulations, dynamically zoom and rotate
10. Productivity tools..
Geometric modifiers, relationship between entities, H,V,Perpendicular,tangent tec
Geometric arrays
Grids
11. Management tools..layers, colors
12. Storing and retrieving CAD models
Product Development Cycle
-Industries have to design and re-design their products to stay put in the
market
-Upon Initial introduction to market, customers define the survival of a
product based on satisfying customers need and their perception
- Elaborate network is enabled to service customer problems with regard to
the problems
-Inspite of being successful in case of deficiencies, today’s market demands
product recall

Successful Product…
#1 The sales volume will pick up gradually and peak after some time. The
product will continue to sell for some time.
#2 The sales will then start gradually declining owing to availability of better
products in the market. It is time for the company to introduce a new and
improved product in the market as well as to retire the old product.
#3 The companies will usually advice the customers that the old product will
be further supported by the sales and service department only for a limited
period of time.
The product development Cycle

The idea of a product may come from a


- patent
- suggestion of the customers
- feedback of the sales and service department
- market research carried out by the marketing or from the R&D department
The next stage is the conceptualization of the product
-The cost at which the product could be sold in the market
- the overall design in terms of shape, functional specifications, ergonomics,
aesthetics etc are considered in detail and finalized
Product Development Spiral

The design development process is an iterative process


Instance from the Ford 1920s model to the current model the amount of design
iteration that has taken place
Variation of sales volume
through the life of a
product

The cycle through which a product goes


through from development to retirement is
called the product life cycle.
Product Sustainability – Life Cycle @ Ford
Traditional or sequential Engineering
The traditional product development process at the prototype development
stage is sequential.
It includes product design, development of manufacturing process and
supporting quality and testing activities, all carried out one after another.
This situation assumes that there is no interaction among the major
departments involved in product manufacturing during the initial
development process.
Design department in a typical sequential product development process
finalizes the design without consulting the manufacturing, quality or
purchase departments.
Any Change may require starting from the first sequence
• Design changes will involve both material and time wastages.
• response to the market requirements will be slow compared to a
competing company which can create an error free design at the
first instance.
Design and Re-design path

Across the wall approach in a traditional design


Concurrent Engineering
Concurrent engineering/ Simultaneous Engineering / Parallel Engineeing is a
methodology of restructuring the product development activity in a manufacturing
organization using a cross functional team approach

is a technique adopted to improve the efficiency of product design and reduce the
product development cycle time.
• brings together a wide spectrum of people from several functional areas in the
design and manufacture of a product
– Representatives from R & D, engineering, manufacturing, materials
management, quality assurance, marketing, vendor development etc. develop
the product as a team.
– Everyone interacts with each other from the start, and they perform their
tasks in parallel.
Intensive teamwork between product development, production planning and
manufacturing is essential for satisfactory implementation of concurrent engineering.

The teamwork also brings additional advantages ; the co-operation between


various specialists and systematic application of special methods such as QFD
(Quality Function Deployment), DFMA (Design for Manufacture and Assembly) and
FMEA (Failure Mode and Effect Analysis) ensures quick optimization of design and
early detection of possible faults in product and production planning.
CE can be defined as…
“Integrated approach to product-design that
takes into account all stages of a product’s life
cycle from design to disposal – including costs,
quality, testing, user needs, customer support,
and logistics”
Sales & R&D
Service

QC & QA Product Design &


Engineering

Planning &
Manufacturing Purchase

May also include


Finance,
Outsourcing
The activities necessary to complete a particular task within a
specific engineering discipline have to emerge wherever possible
from their sequential flow into a concurrent workflow with a high
degree of parallelism
Total quality management is thus closely related to concurrent
engineering.
An example of various activities done in
parallel
The CE Approach

• Focuses on optimizing and distributing


resources within a company or unit during
design and development
• Collaboration is required
• Involves implementation, appraisal, and
continuous improvement initiatives
• Must be applied throughout a system to be
successful (requires strong leadership)
How can the data be managed
• Design changes, status reviews, releases and
their effects on cost, delivery and quality have to
be managed.
• How work flows and the information flow,
storage,retrieval and decision making can be
supported and controlled.

information systems have to be developed which


integrate the different engineering disciplines and
their support tools
Product life cycle management (PLM)

This tool views the entire life cycle of a product as a process that
can be

managed,
measured,
monitored
modified
to achieve continuous improvement.
PLM helps manufacturers acquire the capability to collaborate internally (within the
organization) and externally (outsourcing partners or vendors) collaborate on
product development, manufacture, market and service till the retirement of the
product, consistently maintaining the highest possible efficiency throughout the
value chain.

Product Life Cycle Management is a total production system that tracks a product
from inception to disposal
The Scope of PLM

Product
Lifecycle
Plus the engineering business
systems to make the process
work with the rest of the company
Input and Output Devices of CAD Work-Station
Stages of design process
Graphics system consists of four subsystems:
a. Geometry engine subsystem
b. Scan conversion subsystem
c. Raster subsystem
d. Display subsystem

GEOMETRY ENGINE
• The geometry engine accepts 3-D world co-ordinate data
and converts them into X, Y screen co-ordinates.
• Depth information is manipulated using Z-buffer.
• Colors are also processed.
• The geometry pipeline facilitates among other functions
lighting, clipping,and 3D to 2D projection, viewing
transformations, rotation, scaling and translation.
SCAN CONVERSION
The scan conversion subsystem carries out
polygon decomposition
edge slope calculations
span slope calculations and span interpolation

The output. of the scan


conversion is the
pixel information to the raster
subsystem
RASTER SUBSYSTEM
• The raster subsystem will have usually 24 bit planes.
This will provide eight bit planes for each primary
color (RGB)
• In a typical raster engine five 256K X 4D RAM provide
4 bits of Z-depth.
• The raster information is stored in the frame buffer.
• Twenty 64 K X 4 video RAM provide 4 bits for each
pixel of 1280 X 1024 resolution.
• Entry level systems will have 12 bit planes and high
end systems will have 32 bit planes for the frame
buffer.
DISPLAY SUBSYSTEM
The display subsystem has multi-mode graphics
processors which manage the display, send the Red,
Green, Blue color (RGB) data to the respective
digital to analog converters as well as provide a
video output.
The display devices are classified into two groups:
i. Display devices based on CRT principle
ii. Flat screens

In a color CRT, there are three electron guns, one each for red, green
and blue.
The phosphor dots for red, green and blue are arranged in a triangular
pattern. The individual beams intersect at a shadow mask which directs
a red beam to a red phosphor dot and so on.
FLAT SCREENS
• CRT has the disadvantage that it is extremely
bulky. Moreover, CRT consumes considerable
power with increased heat dissipation
requirements.
• Portability is reduced because of the size and the
material of CRT.
• These disadvantages have prompted the
manufacturers try different types of flat screens
as output devices for computers.
• Flat screens are necessary for laptop, notebook
and palm top computers. Flat screens operate on
the principle of liquid crystal display/LED
We can separate flat-panel displays into two categories: emissive
displays and nonemissive displays.

The emissive displays (or emitters) are devices that displays, and light-
emitting diodes are examples of emissive displays.

Nonemissive displays( or nonemitters) use optical effects to convert


sunlight or light from some other source into graphics patterns. The
most important example of a nonemissive flat-panel display is a
liquid- crystal device.
emissive device is the light-emitting diode (LED). A matrix of diodes is
arranged to form the pixel positions in the display, and picture
defination is stored in refresh buffer. As in scan- line refreshing of a
CRT, information is read from the refresh buffer and converted to
voltage levels that are applied to the diodes to produce the light
patterns in the display.
Liquid- crystal displays (LCDs) are commonly used in systems, such
as calculators (fig.below) and portable, laptop computers (fig.below).
These nonemissive devices produce a picture by passing polarized
light from the surrounding or from an internal light source through a
liquid- crystal material that can be aligned to either block or transmit
the light.
RASTER SCAN GRAPHICS TECHNIQUE
• The screen of a monitor can be considered to consist of a large
number of minute subdivisions called picture elements (pixels, in
short).
• For example, in a typical SVGA monitor, the screen is divided
horizontally into 1024 units and vertically into 768 units.
• The resolution of this monitor is then 1024 x 768.
• A raster CRT graphics device can be considered a matrix of discrete
cells each of which can be made bright.
• Thus it is basically a point plotting device. If a line is to be drawn, it
can be approximated by a series of dots close to the path of the
line.
• A frame buffer is a common method of implementing a raster CRT graphics
device.
• It can be considered to be a large contiguous piece of computer memory. In the
simplest can, there can be one memory bit for each pixel in the raster. This
amount of memory is called a bit plane.
• A 320 X 200 raster requires 64 K memory bits in a single plane. The picture is
built in the frame buffer one bit at a time. The memory bits can be either in 0
or 1 state.
• If a particular pixel is to be addressed, the corresponding bit in the frame buffer
is changed from 0 to 1.
• Since the raster CRT is an analog device, it requires an electrical voltage and
the digital data of the frame buffer has to be converted to an analog voltage
through a digital to analog converter (DAC).
• Additional bit planes can be used for each of the three
color guns. In a 24 bit plane buffer 8 bit planes are used
for each color.
• Each group drives a 8 bit Digital to Analog
Converter (DAC) and can generate 28 = 256 intensities of
red, green and blue.
This when combined together can result in (28)3 = 16,
777, 216 or 16.7 million possible colors.
Symmetric and Simple DDA
POINT PLOTTING
-The frame buffer display is an example of a point plotting device.
- The smallest unit accepted by such displays is a single pixel.
- To construct a useful picture on a point plotting device, a picture must
be built out of several hundreds of pixels.
A Framebuffer is a video output device that drives a video display from
a memory buffer containing a complete frame of data.
The information in the memory buffer typically consists of color values
for every pixel (point that can be displayed) on the screen.

Electron beam (if the display technology uses one) is commanded to


trace a left-to-right, top-to-bottom path across the entire screen, the
way a television renders a broadcast signal.

At the same time, the color information for each point on the screen is
pulled from the framebuffer, creating a set of discrete picture elements
A drawing is created by an assembly of basic entities

Points
Lines
Arcs
Circles

The fundamental principles of generation of some of these entities are discussed in


this lecture

-Point plotting
-Line/Circle plotting
DRAWING OF LINES
Straight line segments are used a great deal in computer generated
pictures. The following criteria have been stipulated for line drawing
displays :
• i. Lines should appear straight
• ii. Lines should terminate accurately
• iii. Lines should have constant density
• iv. Line density should be independent of length and angle
• v. Line should be drawn rapidly
There are several schemes for selecting the pixels between the end
pixels.
One method of generating a line segment is a

Symmetrical Digital differential analyzer (DDA) and other is


Breshanhams algorithm
Line Drawing Algorithms
• Line equation
– Slope-intercept form
y=m.X+c
slope m and Y-intercept c
– Slope
yend - y0  y
m= =
– Y-intercept x end - x 0  x
c = y0 - mx 0
62
Line Drawing Algorithms
• DDA (Digital Differential Analyzer)
– Scan conversion line algorithm
– Line sampled at regular intervals of x, then
corresponding y is calculated
– From left to right
– The calculation has to be simplified as below

63
Line drawing algorithm
• Programmer specifies (x,y) values of end pixels
• Need algorithm to figure out which intermediate pixels are on line path
• Pixel (x,y) values constrained to integer values
• Actual computed intermediate line values may be floats
• Rounding may be required. E.g. computed point
(10.48, 20.51) rounded to (10, 21)
• Rounded pixel value is off actual line path (jaggy!!)
• Sloped lines end up having jaggies
• Vertical, horizontal lines, no jaggies
Digital Differential Analyzer (DDA): Line
Drawing Algorithm
▪Walk through the line, starting at (x0,y0)
▪Constrain x, y increments to values in [0,1] range
▪Case a: x is incrementing faster (m < 1)
▪Step in x=1 increments, compute and round y
▪Case b: y is incrementing faster (m > 1)
▪Step in y=1 increments, compute and round x

(x1,y1)
dy

(x0,y0)
dx
DDA Line Drawing Algorithm (Case a: m <
1)
x = x0 y = y0
y k +1 = y k + m
Illuminate pixel (x, round(y))
(x1,y1)
x = x0 + 1 y = y0 + 1 * m

Illuminate pixel (x, round(y))

x=x+1 y=y+1*m

Illuminate pixel (x, round(y))

Until x == x1
(x0, y0)
DDA Line Drawing Algorithm (Case b:
m > 1)

1 x = x0 y = y0
x k +1 = xk + (x1,y1)
m Illuminate pixel (round(x), y)

y = y0 + 1 x = x0 + 1 * 1/m

Illuminate pixel (round(x), y)

y=y+1 x = x + 1 /m

Illuminate pixel (round(x), y)

(x0,y0) Until y == y1
TCSS458A Isabelle Bichindaritz
DDA ALGORITHM
The digital differential analyzer generates lines from their differential
equations.
The DDA works on the principle that X and Y are simultaneously
incremented by small steps proportional to the first derivatives of X and
Y.
begin
length : = abs (X2– X1) ;
if abs (Y2–Y1) < length then length: = abs (Y2–Y1);
X - incr : = (X2 – X1) /length ;
Y - incr : = (Y2 – Y1) /length ;
X : = X1 + 0.5 ; Y = Y1 + 0.5 ;
for i : = 1 to length do
begin
plot (trunc (X) ; trunc(Y) ;
X : = X + X - incr ;
Y : = Y + Y - incr ;
end;
end.
Line Drawing Algorithm Drawbacks

• DDA is the simplest line drawing algorithm


– Not very efficient
– Round operation is expensive
• Optimized algorithms typically used.
– Integer DDA
– E.g.Bresenham algorithm (Hill, 10.4.1)
• Bresenham algorithm
– Incremental algorithm: current value uses previous value
– Integers only: avoid floating point arithmetic
– Several versions of algorithm: we’ll describe midpoint
version of algorithm
Line Drawing Algorithms
• Line drawn as pixels
• Graphics system
– Projects the endpoints to their pixel locations in the frame buffer
(screen coordinates as integers)
– Finds a path of pixels between the two
– Loads the color
– Plots the line on the monitor from frame buffer (video controller)
– Rounding causes all lines except horizontal or vertical to be displayed
as jigsaw appearance (low resolution)
– Improvement: high resolution, or adjust pixel intensities on the line
path.
Line Drawing Algorithms
• Advantage
– Does not calculate coordinates based on the
complete equation (uses offset method)
• Disadvantage
– Round-off errors are accumulated, thus line
diverges more and more from straight line
– Round-off operations take time
• Perform integer arithmetic by storing float as
integers in numerator and denominator and
performing integer artithmetic.
The Bresenham Line Algorithm
• The Bresenham algorithm is
another incremental scan
conversion algorithm
• The big advantage of this
algorithm is that it uses only
integer calculations
Jack Bresenham worked
for 27 years at IBM
before entering
academia. Bresenham
developed his famous
algorithms at IBM in the
e a r l y 1 9 6 0 s
Line Drawing Algorithms (cont.)
• Bresenham’s line drawing
– Efficient line drawing algorithm using only incremental
integer calculations
– Can be adapted to draw circles and other curves
• Principle
– Vertical axes show scan line positions
– Horizontal axes show pixel columns
– At each step, determine the best next pixel based on the
sign of an integer parameter whose value is proportional to
the difference between the vertical separations of the two
pixel positions from the actual line.

75
The Big Idea
• Move across the x axis in unit intervals and at
each step choose between two different y
coordinates
For example, from
5
position (2, 3) we have
(xk+1, yk+1)
4
to choose between (3,
(xk, yk) 3) and (3, 4)
3
We would like the
(xk+1, yk)
2
point that is closer to
the original line
2 3 4 5
Deriving The Bresenham Line Algorithm
• At sample position xk+1 the yk+1
vertical separations from the dupper
mathematical line are labelled y
dupper and dlower dlower
y
k

xk+1
The y coordinate on the mathematical line at xk+1
is:
y = m( xk + 1) + b
BRESENHAM’S LINE DRAWING ALGORITHM
(for |m| < 1.0)
1. Input the two line end-points, storing the left end-point in
(x0, y0)
2. Plot the point (x0, y0)
3. Calculate the constants Δx, Δy, 2Δy, and (2Δy - 2Δx) and
get the first value for the decision parameter as:
p 0 = 2  y − x
4. At each xk along the line, starting at k = 0, perform the
following test. If pk < 0, the next point to plot is
(xk+1, yk) and:

pk +1 = pk + 2y
The Bresenham Line Algorithm (cont…)
Otherwise, the next point to plot is (xk+1, yk+1) and:
pk +1 = pk + 2y − 2x
5. Repeat step 4 (Δx – 1) times

The algorithm and derivation above assumes


slopes are less than 1. for other slopes we
need to adjust the algorithm slightly
Bresenham Example
• Let’s have a go at this
• Let’s plot the line from (20, 10) to (30, 18)
• First off calculate all of the constants:
– Δx: 10
– Δy: 8
– 2Δy: 16
– 2Δy - 2Δx: -4
• Calculate the initial decision parameter p0:
– p0 = 2Δy – Δx = 6
Bresenham Example
• We plot the initial point (x0 , y0)=(20,10) and determine
successive pixel positions along the line path from the decision
parameter as

K pk (xk +1, yk +1) K pk (xk +1, yk +1)


0 6 (21,11) 5 6 (26,15)
1 2 (22,12) 6 2 (27,16)
2 -2 (23,12) 7 -2 (28,16)
3 14 (24,13) 8 14 (29,17)
4 10 (25,14) 9 10 (30,18)
Bresenham Example (cont…)
18 k pk (xk+1,yk+1)

17 0
16 1

15 2

14 3

13
4
5
12
6
11
7
10
8
20 21 22 23 24 25 26 27 28 29 30
9
Problem1: Plot the line from (1, 1) to (8, 5)

Pk Pk+1 Xk+1 Yk+1


1 1
1 -5 2 2
-5 3 3 2
3 -3 4 3
-3 5 5 3
5 -1 6 4
-1 7 7 4
7 1 7 5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy