SlideShare a Scribd company logo
1 of 26
UNIT - II
❖Line Drawing Algorithm
❖Loading the Frame Buffer
❖Line Function
❖Circle-Generating Algorithm
❖Line attributes
❖Curve attributes
❖Colour and gray scale levels
❖Area fill attributes
❖Character attributes
❖Bundled attributes
❖Inquiry functions
LINE DRAWING ALGORITHM
❖The Cartesian slope-intercept equation for a straight line is {display style Y=mx
+b } With m representing the slope of the line and b as the y intercept. Given that
the two endpoints of the line segment are specified at positions {display style
(x1,y1)} and {display style (x2,y2)}. We can determine values for the slope m and
y intercept b with the following calculations, {display style m=(y2-y1)/(x2-
x1)} so, {display style b=y1-m.x1}.
DDA ALGORITHM
❖DDA stands for Digital Differential Analyzer. It is an incremental method of scan
conversion of line.
❖Advantage:
❖It is a faster method than method of using direct use of line equation.
❖This method does not use multiplication theorem.
❖It allows us to detect the change in the value of x and y ,so plotting of same point
twice is not possible.
❖This method gives overflow indication when a point is repositioned.
❖It is an easy method because each step involves just two additions.
DISADVANTAGE
❖It involves floating point additions rounding off is done. Accumulations
of round off error cause accumulation of error.
❖Rounding off operations and floating point operations consumes a lot
of time.
❖It is more suitable for generating line using the software. But it is less
suited for hardware implementation.
BREHENSAM LINE DRAWING
❖Bresenham's line algorithm is a line drawing algorithm that determines the points of an n-
dimensional raster that should be selected in order to form a close approximation to a straight
line between two points.
❖ It is commonly used to draw line primitives in a bitmap image (e.g. on a computer screen), as it
uses only integer addition, subtraction and bit shifting, all of which are very cheap operations in
standard computer architectures.
❖ It is an incremental error algorithm. It is one of the earliest algorithms developed in the field
of computer graphics. An extension to the original algorithm may be used for drawing circles.
LOADING FRAME BUFFER
❖A framebuffer (frame buffer, or sometimes framestore) is a portion of random-
access memory (RAM) containing a bitmap that drives a video display. It is
a memory buffercontaining a complete frame of data.Modern video cards contain
framebuffer circuitry in their cores. This circuitry converts an in-memory bitmap
into a video signal that can be displayed on a computer monitor.
LINE FUNCTION
❖Line function is the one which is directly involved in the core work of an
organization. It involves the primary activities such as manufacturing, selling,
purchasing etc which are required to meet the business objectives.
❖Operations, marketing, and sales are the examples of line functions.
❖Implementation of the polyline procedure is accomplished by first performing a
series of co ordinate transformation, then making a sequence of calls to a device-
level line-drawing routine.
CIRCLE GENERATING ALGORITHM
❖Drawing a circle on the screen is a little complex
than drawing a line. There are two popular algorithms
for generating a circle − Bresenham’s
Algorithm and Midpoint Circle Algorithm. These
algorithms are based on the idea of determining the
subsequent points required to draw the circle. Let us
discuss the algorithms in detail −
❖The equation of circle is X2+Y2=r2,X2+Y2=r2, where
r is radius.
ALGORITHM
❖Step 1 − Get the coordinates of the center of the circle and radius, and store them in x, y, and R
respectively. Set P=0 and Q=R.
❖Step 2 − Set decision parameter D = 3 – 2R.
❖Step 3 − Repeat through step-8 while P ≤ Q.
❖Step 4 − Call Draw Circle X,Y,P,QX,Y,P,Q.
❖Step 5 − Increment the value of P.
❖Step 6 − If D < 0 then D = D + 4P + 6.
❖Step 7 − Else Set R = R - 1, D = D + 4P−QP−Q + 10.
❖Step 8 − Call Draw Circle X,Y,P,QX,Y,P,Q.
ATTRIBUTES: LINE, CURVE, AREA FILL, TEXT
❖Basic attributes of a straight line segment are its type, its width, and its colour. In some
graphics packages, lines can also be displayed using selected pen or brush options.
❖Line-type attribute - solid lines, dashed lines, and dotted lines.
❖We modify a line drawing algorithm to generate such lines by setting the length and spacing of
displayed solid
❖To set line type attributes in a PHICS application program, a user invokes the function
setline type (It)
❖ where parameter I t is assigned a positive integer value of 1,2,3, or 4 to generate lines that are,
respectively, solid, dashed, dotted, or dash-dotted.
THANK YOU

More Related Content

What's hot

Cad cam mi d bits [pls visit our blog sres11meches]
Cad cam mi d bits [pls visit our blog sres11meches]Cad cam mi d bits [pls visit our blog sres11meches]
Cad cam mi d bits [pls visit our blog sres11meches]
Sres IImeches
 
Presentation 2(power point presentation) dis2016
Presentation 2(power point presentation) dis2016Presentation 2(power point presentation) dis2016
Presentation 2(power point presentation) dis2016
Daniel Omunting
 
Boolean Algebra by SUKHDEEP SINGH
Boolean Algebra by SUKHDEEP SINGHBoolean Algebra by SUKHDEEP SINGH
Boolean Algebra by SUKHDEEP SINGH
Sukhdeep Bisht
 

What's hot (20)

Cad cam mi d bits [pls visit our blog sres11meches]
Cad cam mi d bits [pls visit our blog sres11meches]Cad cam mi d bits [pls visit our blog sres11meches]
Cad cam mi d bits [pls visit our blog sres11meches]
 
Unit 1 cim qb
Unit 1 cim qbUnit 1 cim qb
Unit 1 cim qb
 
Aplikom03 excel or
Aplikom03 excel orAplikom03 excel or
Aplikom03 excel or
 
CS 354 Bezier Curves
CS 354 Bezier Curves CS 354 Bezier Curves
CS 354 Bezier Curves
 
Aplikom11 matlab or
Aplikom11 matlab orAplikom11 matlab or
Aplikom11 matlab or
 
Aplikom07 math cador
Aplikom07 math cadorAplikom07 math cador
Aplikom07 math cador
 
Digital Image Processing (Lab 09 and 10)
Digital Image Processing (Lab 09 and 10)Digital Image Processing (Lab 09 and 10)
Digital Image Processing (Lab 09 and 10)
 
Presentation 2(power point presentation) dis2016
Presentation 2(power point presentation) dis2016Presentation 2(power point presentation) dis2016
Presentation 2(power point presentation) dis2016
 
paper
paperpaper
paper
 
COM2304: Morphological Image Processing
COM2304: Morphological Image ProcessingCOM2304: Morphological Image Processing
COM2304: Morphological Image Processing
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
 
Boolean Algebra by SUKHDEEP SINGH
Boolean Algebra by SUKHDEEP SINGHBoolean Algebra by SUKHDEEP SINGH
Boolean Algebra by SUKHDEEP SINGH
 
Graphics file
Graphics fileGraphics file
Graphics file
 
Image processing fundamentals
Image processing fundamentalsImage processing fundamentals
Image processing fundamentals
 
Linear Smoothing, Median, and Sharpening Filter
Linear Smoothing, Median, and Sharpening FilterLinear Smoothing, Median, and Sharpening Filter
Linear Smoothing, Median, and Sharpening Filter
 
K map
K mapK map
K map
 
Computer graphics 2
Computer graphics 2Computer graphics 2
Computer graphics 2
 
Dda algo notes
Dda algo notesDda algo notes
Dda algo notes
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 
Roba new
Roba newRoba new
Roba new
 

Similar to UNIT-II

CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
RajJain516913
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
amitsarda3
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygons
aa11bb11
 

Similar to UNIT-II (20)

Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
dda algorithm-cg.pptx
dda algorithm-cg.pptxdda algorithm-cg.pptx
dda algorithm-cg.pptx
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
 
Unit 2
Unit 2Unit 2
Unit 2
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx
 
Study on Fundamentals of Raster Scan Graphics
Study on Fundamentals of Raster Scan GraphicsStudy on Fundamentals of Raster Scan Graphics
Study on Fundamentals of Raster Scan Graphics
 
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdf
 
Mvs adas
Mvs adasMvs adas
Mvs adas
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
 
IBM Insight 2015 - 1823 - Geospatial analytics with dashDB in the cloud
IBM Insight 2015 - 1823 - Geospatial analytics with dashDB in the cloudIBM Insight 2015 - 1823 - Geospatial analytics with dashDB in the cloud
IBM Insight 2015 - 1823 - Geospatial analytics with dashDB in the cloud
 
Module-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdfModule-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdf
 
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
 
Primitives
PrimitivesPrimitives
Primitives
 
Line drawing Algorithm DDA in computer Graphics.pdf
Line drawing Algorithm DDA in computer Graphics.pdfLine drawing Algorithm DDA in computer Graphics.pdf
Line drawing Algorithm DDA in computer Graphics.pdf
 
Dda line algorithm presentatiion
Dda line algorithm presentatiionDda line algorithm presentatiion
Dda line algorithm presentatiion
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Introduction to Computer graphics
Introduction to Computer graphicsIntroduction to Computer graphics
Introduction to Computer graphics
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 

Recently uploaded (20)

An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 

UNIT-II

  • 1. UNIT - II ❖Line Drawing Algorithm ❖Loading the Frame Buffer ❖Line Function ❖Circle-Generating Algorithm ❖Line attributes ❖Curve attributes ❖Colour and gray scale levels ❖Area fill attributes ❖Character attributes ❖Bundled attributes ❖Inquiry functions
  • 2. LINE DRAWING ALGORITHM ❖The Cartesian slope-intercept equation for a straight line is {display style Y=mx +b } With m representing the slope of the line and b as the y intercept. Given that the two endpoints of the line segment are specified at positions {display style (x1,y1)} and {display style (x2,y2)}. We can determine values for the slope m and y intercept b with the following calculations, {display style m=(y2-y1)/(x2- x1)} so, {display style b=y1-m.x1}.
  • 3.
  • 4. DDA ALGORITHM ❖DDA stands for Digital Differential Analyzer. It is an incremental method of scan conversion of line. ❖Advantage: ❖It is a faster method than method of using direct use of line equation. ❖This method does not use multiplication theorem. ❖It allows us to detect the change in the value of x and y ,so plotting of same point twice is not possible. ❖This method gives overflow indication when a point is repositioned. ❖It is an easy method because each step involves just two additions.
  • 5. DISADVANTAGE ❖It involves floating point additions rounding off is done. Accumulations of round off error cause accumulation of error. ❖Rounding off operations and floating point operations consumes a lot of time. ❖It is more suitable for generating line using the software. But it is less suited for hardware implementation.
  • 6.
  • 7. BREHENSAM LINE DRAWING ❖Bresenham's line algorithm is a line drawing algorithm that determines the points of an n- dimensional raster that should be selected in order to form a close approximation to a straight line between two points. ❖ It is commonly used to draw line primitives in a bitmap image (e.g. on a computer screen), as it uses only integer addition, subtraction and bit shifting, all of which are very cheap operations in standard computer architectures. ❖ It is an incremental error algorithm. It is one of the earliest algorithms developed in the field of computer graphics. An extension to the original algorithm may be used for drawing circles.
  • 8. LOADING FRAME BUFFER ❖A framebuffer (frame buffer, or sometimes framestore) is a portion of random- access memory (RAM) containing a bitmap that drives a video display. It is a memory buffercontaining a complete frame of data.Modern video cards contain framebuffer circuitry in their cores. This circuitry converts an in-memory bitmap into a video signal that can be displayed on a computer monitor.
  • 9.
  • 10.
  • 11. LINE FUNCTION ❖Line function is the one which is directly involved in the core work of an organization. It involves the primary activities such as manufacturing, selling, purchasing etc which are required to meet the business objectives. ❖Operations, marketing, and sales are the examples of line functions. ❖Implementation of the polyline procedure is accomplished by first performing a series of co ordinate transformation, then making a sequence of calls to a device- level line-drawing routine.
  • 12. CIRCLE GENERATING ALGORITHM ❖Drawing a circle on the screen is a little complex than drawing a line. There are two popular algorithms for generating a circle − Bresenham’s Algorithm and Midpoint Circle Algorithm. These algorithms are based on the idea of determining the subsequent points required to draw the circle. Let us discuss the algorithms in detail − ❖The equation of circle is X2+Y2=r2,X2+Y2=r2, where r is radius.
  • 13. ALGORITHM ❖Step 1 − Get the coordinates of the center of the circle and radius, and store them in x, y, and R respectively. Set P=0 and Q=R. ❖Step 2 − Set decision parameter D = 3 – 2R. ❖Step 3 − Repeat through step-8 while P ≤ Q. ❖Step 4 − Call Draw Circle X,Y,P,QX,Y,P,Q. ❖Step 5 − Increment the value of P. ❖Step 6 − If D < 0 then D = D + 4P + 6. ❖Step 7 − Else Set R = R - 1, D = D + 4P−QP−Q + 10. ❖Step 8 − Call Draw Circle X,Y,P,QX,Y,P,Q.
  • 14.
  • 15.
  • 16.
  • 17. ATTRIBUTES: LINE, CURVE, AREA FILL, TEXT ❖Basic attributes of a straight line segment are its type, its width, and its colour. In some graphics packages, lines can also be displayed using selected pen or brush options. ❖Line-type attribute - solid lines, dashed lines, and dotted lines. ❖We modify a line drawing algorithm to generate such lines by setting the length and spacing of displayed solid ❖To set line type attributes in a PHICS application program, a user invokes the function setline type (It) ❖ where parameter I t is assigned a positive integer value of 1,2,3, or 4 to generate lines that are, respectively, solid, dashed, dotted, or dash-dotted.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.