SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Scan Conversion
Dept of Computer Science & Engineering
Islamic University, Kushtia
Graphics Primitives
 The basic building blocks for pictures are referred to as output
primitives.
 They include:
 character strings and
 geometric entities,
 Points,
 Straight lines,
 Curved Lines,
 Circle, Ellipse
 Filled areas (polygons, circles, etc.), and
 Shapes defined with arrays of color points.
 Routines for generating output primitives provide the basic
tools for constructing pictures.
Coordinates
Pixel addressing in raster graphics
Pixel
address
Pixel
x x+1 x+2 x+3 x+4
y
y+1
y+2
y+3
Theoretical length
Actual length
POINTS AND LINES
 Point plotting is accomplished by converting a single
coordinate position furnished by an application program
into appropriate operations for the output device in use.
 For example, CRT monitor, the electron beam is
turned on to illuminate the screen phosphor at the
selected location
POINTS AND LINES
 Line drawing is accomplished by calculating
intermediate positions along the line path
between two specified endpoint positions.
 Digital devices display a straight line segment by
plotting discrete points between the two
endpoints.
Discrete coordinate positions along the line
path are calculated from the equation of the
line.
Theoretical Line
Line on Display Devices
Line drawing algorithms
 Geometric
 Display devices
 DDA
 Bresenham
Line drawing algorithms
 The Cartesian slope-intercept
equation for a straight line is
 with m representing the slope of
the line and b as they intercept
Line drawing algorithms
 Problems in Geometric Equations:
 To plot a line need
 Multiplication, Division or more complex task
 Computer needs lot of task
 This degrade overall performance
 Interactive graphics need faster response
 Use DDA, Bresenham’s algorithm
 Interactive Graphics: where user dynamically controls
the presentation of graphics model on a computer
display
Requirements
1. Must compute integer coordinates of pixels which lie on or
near a line or circle.
2. Pixel level algorithms are invoked hundreds or thousands of
times when an image is created or modified.
3. Lines must create visually satisfactory images.
 Lines should appear straight
 Lines should terminate accurately
 Lines should have constant density
 Line density should be independent of line length and
angle.
4. Line algorithm should always be defined.
DDA (Digital Differential Analyzer)
m < 1
DDA (Digital Differential Analyzer)
m > 1
m > 1
DDA Algorithms
 DDA is a scan-conversion line algorithm based on
calculating either y or x
 If the slope is less than or equal to 1, we sample at unit x
intervals ( x = 1) and compute each successive y value
as
where k=1 for first point and increases by 1until the final
endpoint is reached
 Calculated y values must be rounded to the nearest
integer
DDA Algorithms
 For lines with a positive slope greater than 1, reverse the
roles of x and y.
 we sample at unit y intervals (y = 1) and calculate
each succeeding x value as
equation (a) and (b) are based on the assumption that
lines are to be processed from the left endpoint to the
right endpoint
DDA Algorithms
 If this processing is reversed, that is from right to left
 The DDA algorithm is a faster method for calculating
pixel positions than the direct use
 It eliminates the multiplication by making use of raster
characteristics
DDA at a glance
 input line endpoints, (x1,y1) and (x2, y2)
 set pixel at position (x1,y1)
 calculate slope m
 Case |m|≤1: repeat the following steps until (x2, y2) is
reached:
yi+1 = yi + y/ x
xi+1 = xi + 1
set pixel at position (xi+1,Round(yi+1))
 Case |m|>1: repeat the following steps until (x2, y2) is
reached:
xi+1 = xi + x/ y
yi+1 = yi + 1
set pixel at position (Round(xi+1), yi+1)
Bresenham’s Line Algorithm
 Bresenham’s scan converts lines using only incremental
integer calculations that can be adapted to display
circles and other curves.
|m|<1 |m|>1
Bresenham’s Line Algorithm
|m|<1
Bresenham’s Line Algorithm (m<1)
 Starting from the left endpoint (x0, y0) of a given line,
 We step to each successive column (x position) and
 Plot the pixel whose scan-line y value is closest to the
line path.
 Let we have determined the pixel at (xk, yk) to be
displayed,
 we next need to decide which pixel to plot in column
xk+1,
 Our choices are the pixels at positions (xk+1, yk) and
(xk+1, yk+1)
Bresenham’s Line Algorithm
d1
d2
xk xk+1=x+1
yk
y = m(x+1) + b
y = mx + b
yk+1=y+1
Bresenham’s Line Algorithm
Bresenham’s Line Algorithm
 They coordinate on the mathematical line at pixel column
position xk+1 is calculated as
 The difference between these two separations is
Bresenham’s Line Algorithm
where pk = x(d1 – d2) is decision parameter for the kth
step in the line algorithm
The sign of p, is the same as the sign of (d1 – d2) since
x > 0
and c is constant and c = 2y + x(2b – 1),
Bresenham’s Line Algorithm
 If (d1 < d2) then pk is negative
 We plot lower pixel (xk+1, yk)
 If (d1  d2) then pk is positive
 We plot lower pixel (xk+1, yk+1)
 For next decision parameter pk+1
 Increment x as xk+1 = xk+1
Bresenham’s Line Algorithm
 The term (yk+1–yk) of eq-(f) either 0 or 1 depending on
sign of pk
Bresenham’s Line Algorithm
 If pk < 0 true line close to lower pixel and yk +1 = yk
pk+1 = pk + 2y -- g(a)
 If pk  0 true line close to lower pixel and yk +1 = yk+1
pk+1 = pk + 2y – 2x -- g(b)
 First decision parameter p0 from eq-(d) as considering the line
start from (0, 0) as
p0 = 2y.0 – 2x.0 + c
p0 = c = 2y + x(2b – 1)
but y = mx + b or b = 0
p0 = 2y - x
Bresenham’s Line Algorithm (m<1)
Bresenham’s Line Algorithm (m<1)
Bresenham’s Line Algorithm (m<1)
Bresenham’s Line Algorithm

Weitere ähnliche Inhalte

Was ist angesagt?

Computer Graphics
Computer GraphicsComputer Graphics
Computer GraphicsAnkur Soni
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversionMohd Arif
 
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath YogiTekendra Nath Yogi
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)Timbal Mayank
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphicssabbirantor
 
Model1 Active and Passive Graphics.pptx
Model1 Active and Passive Graphics.pptxModel1 Active and Passive Graphics.pptx
Model1 Active and Passive Graphics.pptxRahul Borate
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphicsSHIVANI SONI
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithmnehrurevathy
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesOmprakash Chauhan
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer GraphicsSanu Philip
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer GraphicsSanu Philip
 
Back face detection
Back face detectionBack face detection
Back face detectionPooja Dixit
 
2D Transformation in Computer Graphics
2D Transformation in Computer Graphics2D Transformation in Computer Graphics
2D Transformation in Computer GraphicsA. S. M. Shafi
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphicsKALESHWAR KUMAR
 

Was ist angesagt? (20)

Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
 
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath YogiB. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
B. SC CSIT Computer Graphics Unit 3 By Tekendra Nath Yogi
 
Clipping
ClippingClipping
Clipping
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
Model1 Active and Passive Graphics.pptx
Model1 Active and Passive Graphics.pptxModel1 Active and Passive Graphics.pptx
Model1 Active and Passive Graphics.pptx
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - Notes
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
Three dimensional concepts - Computer Graphics
Three dimensional concepts - Computer GraphicsThree dimensional concepts - Computer Graphics
Three dimensional concepts - Computer Graphics
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
Back face detection
Back face detectionBack face detection
Back face detection
 
2D Transformation in Computer Graphics
2D Transformation in Computer Graphics2D Transformation in Computer Graphics
2D Transformation in Computer Graphics
 
2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphics
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
 

Ähnlich wie Scan Conversion and Graphics Primitives

Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniyaTutorialsDuniya.com
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsAmol Gaikwad
 
Unit 2
Unit 2Unit 2
Unit 2ypnrao
 
Lecture _Line Scan Conversion.ppt
Lecture _Line Scan Conversion.pptLecture _Line Scan Conversion.ppt
Lecture _Line Scan Conversion.pptGaganvirKaur
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2SanthiNivas
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygonsaa11bb11
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons dericationKumar
 
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfAOUNHAIDER7
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output PrimitivesPrathimaBaliga
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxIndhuMcamphil
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxAlamelu
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualAnkit Kumar
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimediasaranyan75
 
Computer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivesComputer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivessaranyan75
 

Ähnlich wie Scan Conversion and Graphics Primitives (20)

Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniya
 
Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithms
 
Unit 2
Unit 2Unit 2
Unit 2
 
Lecture _Line Scan Conversion.ppt
Lecture _Line Scan Conversion.pptLecture _Line Scan Conversion.ppt
Lecture _Line Scan Conversion.ppt
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
 
Computer graphics notes watermark
Computer graphics notes watermarkComputer graphics notes watermark
Computer graphics notes watermark
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygons
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons derication
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
 
lecture 1.pptx
lecture 1.pptxlecture 1.pptx
lecture 1.pptx
 
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdf
 
Chapter 3 Output Primitives
Chapter 3 Output PrimitivesChapter 3 Output Primitives
Chapter 3 Output Primitives
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Lect14 lines+circles
Lect14 lines+circlesLect14 lines+circles
Lect14 lines+circles
 
Output Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and MultimediaOutput Primitives in Computer Graphics and Multimedia
Output Primitives in Computer Graphics and Multimedia
 
Computer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitivesComputer Graphics and Multimedia Output primitives
Computer Graphics and Multimedia Output primitives
 

Kürzlich hochgeladen

Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 

Kürzlich hochgeladen (20)

Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 

Scan Conversion and Graphics Primitives

  • 1. Scan Conversion Dept of Computer Science & Engineering Islamic University, Kushtia
  • 2. Graphics Primitives  The basic building blocks for pictures are referred to as output primitives.  They include:  character strings and  geometric entities,  Points,  Straight lines,  Curved Lines,  Circle, Ellipse  Filled areas (polygons, circles, etc.), and  Shapes defined with arrays of color points.  Routines for generating output primitives provide the basic tools for constructing pictures.
  • 4. Pixel addressing in raster graphics Pixel address Pixel x x+1 x+2 x+3 x+4 y y+1 y+2 y+3 Theoretical length Actual length
  • 5. POINTS AND LINES  Point plotting is accomplished by converting a single coordinate position furnished by an application program into appropriate operations for the output device in use.  For example, CRT monitor, the electron beam is turned on to illuminate the screen phosphor at the selected location
  • 6. POINTS AND LINES  Line drawing is accomplished by calculating intermediate positions along the line path between two specified endpoint positions.  Digital devices display a straight line segment by plotting discrete points between the two endpoints. Discrete coordinate positions along the line path are calculated from the equation of the line.
  • 8. Line on Display Devices
  • 9. Line drawing algorithms  Geometric  Display devices  DDA  Bresenham
  • 10. Line drawing algorithms  The Cartesian slope-intercept equation for a straight line is  with m representing the slope of the line and b as they intercept
  • 11. Line drawing algorithms  Problems in Geometric Equations:  To plot a line need  Multiplication, Division or more complex task  Computer needs lot of task  This degrade overall performance  Interactive graphics need faster response  Use DDA, Bresenham’s algorithm  Interactive Graphics: where user dynamically controls the presentation of graphics model on a computer display
  • 12. Requirements 1. Must compute integer coordinates of pixels which lie on or near a line or circle. 2. Pixel level algorithms are invoked hundreds or thousands of times when an image is created or modified. 3. Lines must create visually satisfactory images.  Lines should appear straight  Lines should terminate accurately  Lines should have constant density  Line density should be independent of line length and angle. 4. Line algorithm should always be defined.
  • 13. DDA (Digital Differential Analyzer) m < 1
  • 14. DDA (Digital Differential Analyzer) m > 1 m > 1
  • 15. DDA Algorithms  DDA is a scan-conversion line algorithm based on calculating either y or x  If the slope is less than or equal to 1, we sample at unit x intervals ( x = 1) and compute each successive y value as where k=1 for first point and increases by 1until the final endpoint is reached  Calculated y values must be rounded to the nearest integer
  • 16. DDA Algorithms  For lines with a positive slope greater than 1, reverse the roles of x and y.  we sample at unit y intervals (y = 1) and calculate each succeeding x value as equation (a) and (b) are based on the assumption that lines are to be processed from the left endpoint to the right endpoint
  • 17. DDA Algorithms  If this processing is reversed, that is from right to left  The DDA algorithm is a faster method for calculating pixel positions than the direct use  It eliminates the multiplication by making use of raster characteristics
  • 18. DDA at a glance  input line endpoints, (x1,y1) and (x2, y2)  set pixel at position (x1,y1)  calculate slope m  Case |m|≤1: repeat the following steps until (x2, y2) is reached: yi+1 = yi + y/ x xi+1 = xi + 1 set pixel at position (xi+1,Round(yi+1))  Case |m|>1: repeat the following steps until (x2, y2) is reached: xi+1 = xi + x/ y yi+1 = yi + 1 set pixel at position (Round(xi+1), yi+1)
  • 19. Bresenham’s Line Algorithm  Bresenham’s scan converts lines using only incremental integer calculations that can be adapted to display circles and other curves. |m|<1 |m|>1
  • 21. Bresenham’s Line Algorithm (m<1)  Starting from the left endpoint (x0, y0) of a given line,  We step to each successive column (x position) and  Plot the pixel whose scan-line y value is closest to the line path.  Let we have determined the pixel at (xk, yk) to be displayed,  we next need to decide which pixel to plot in column xk+1,  Our choices are the pixels at positions (xk+1, yk) and (xk+1, yk+1)
  • 22. Bresenham’s Line Algorithm d1 d2 xk xk+1=x+1 yk y = m(x+1) + b y = mx + b yk+1=y+1
  • 24. Bresenham’s Line Algorithm  They coordinate on the mathematical line at pixel column position xk+1 is calculated as  The difference between these two separations is
  • 25. Bresenham’s Line Algorithm where pk = x(d1 – d2) is decision parameter for the kth step in the line algorithm The sign of p, is the same as the sign of (d1 – d2) since x > 0 and c is constant and c = 2y + x(2b – 1),
  • 26. Bresenham’s Line Algorithm  If (d1 < d2) then pk is negative  We plot lower pixel (xk+1, yk)  If (d1  d2) then pk is positive  We plot lower pixel (xk+1, yk+1)  For next decision parameter pk+1  Increment x as xk+1 = xk+1
  • 27. Bresenham’s Line Algorithm  The term (yk+1–yk) of eq-(f) either 0 or 1 depending on sign of pk
  • 28. Bresenham’s Line Algorithm  If pk < 0 true line close to lower pixel and yk +1 = yk pk+1 = pk + 2y -- g(a)  If pk  0 true line close to lower pixel and yk +1 = yk+1 pk+1 = pk + 2y – 2x -- g(b)  First decision parameter p0 from eq-(d) as considering the line start from (0, 0) as p0 = 2y.0 – 2x.0 + c p0 = c = 2y + x(2b – 1) but y = mx + b or b = 0 p0 = 2y - x