SlideShare a Scribd company logo
 Output primitives are the basic geometric
  structures which facilitate or describe a
  scene/picture.
 Example of these include:
  points, lines, curves (circles, conics etc),
  surfaces, fill colour, character string etc.
In order to draw the primitive objects, one has to
    first scan convert the object.

Scan convert: Refers to the operation of finding
   out the location of pixels and then setting the
   values of corresponding bits, in the graphic
   memory, to the desired intensity code.
y       means that for a unit (1) change in x
    m
x       there is
        m-change in y.
x   1   means that for a unit (1) change in y
y   m   there is
        1/m change in x.


                                                5
Uses differential equation of the line : m
  If slope |m| 1 then increment x in steps of 1 pixel and
  find corresponding y-values.
  If slope |m| 1 then increment y in steps of 1 pixel and
  find corresponding x-values.
                                            
                                            
                                        
                                        
                                 
                                 
                             
                             
  step through in x                    step through in y

                                                            6
 A line with positive slope (Left to Right)
  If m <= 1, sample at unit x intervals (Δx = 1)
and compute successive y values as:
        yk+1 = yk + m.
 If m >1, sample at unit y intervals (Δy =1) and
compute successive x values as:
       xk+1 = xk + 1/m.
 A line with positive slope (Right to Left)
 If m <= 1, sample at unit x intervals (Δx =-1)
and
    compute successive y values as:
            yk+1 = yk – m
 If m >1, sample at unit y intervals (Δy = -1) and
 compute successive x values as:
            xk+1 = xk - 1/m
 A line with negative slope (Left to Right)
 If |m| <= 1, sample at unit x intervals (Δx = 1)
and
       compute successive y values as:
              yk+1 = yk + m
 If |m| >1, sample at unit y intervals (Δy =-1)
and compute successive x values as:
             xk+1 = xk - 1/m
 A line with negative slope (Right to Left)
If |m| <=1, sample at unit x intervals (Δx =1)
and
      compute successive y values as:
             yk+1 = yk - m
 If |m| >1, sample at unit y intervals (Δy =1)
and compute successive x values as:
             xk+1 = xk + 1/m
1) Accept the end point co-ordinates of the
line segment AB ie A(x1,x2) and B(x2,y2).

2)   Calculate dx and dy.

3) If abs(dx)>=abs(dy) then ,
        Step=dx else Step=dy.
4) Let x increment = dx/Step ;
   Let y increment = dy/Step.

5) Display the pixels at standing portion put
pixel (x,y,white).

6) Compute the next co-ordinate position along
the line path
           xk+1 = xk + x increment
           yk+1 = yk + y increment
            Put Pixel(xk+1 , yk+1 ,white).
7) If xk+1=x2 OR / AND yk+1=y2
            then STOP else go to Step (4).
1) In Bresenham’s Line Drawing Algorithm the
pixel positions along a line path are obtained by
determining the pixel i.e nearer the line at each
step.
 2) It is an efficient raster line generation
algorithm.
1) Accept the end point co-ordinates of the
line segment AB ie A(x1,x2) and B(x2,y2).

2) Calculate dx and dy.

3) If abs(dy)<=abs(dx) ie slope |m|<=1

 (a) Compute initial decision parameter
     Po= 2abs(dy)-abs(dx).
(b) At each xk position perform the following
if Pk <0 i.e d1< d2 then,

 x increment=dx/abs(dx) AND y increment=0
            Pk+1= Pk + 2abs(dy)
else,

Pk >0 ie d1>d2
                     X increment =dx/abs(dx)
                     Y increment =dy/abs(dy)

   Pk+1= Pk +2abs(dy)-2abs(dx).
4) If abs(dy) > abs(dx) ie slope |m|>1

(a) Compute initial decision parameter
     Po= 2abs(dx)-abs(dy)

(b) At each xk position,perform the following if
Pk < 0 i.e d1 < d2 then
                        x increment=0
                        y increment=dy/abs(dy)
          Pk+1= Pk + 2abs(dx)
Else,
  Pk >0 ie d1>d2
                    X increment=dx/abs(dx)
                    Y increment=dy/abs(dy)
    Pk+1= Pk +2abs(dx)-2abs(dy).

5) Calculate : xnext = xk + x increment
               ynext = yk + y increment.
   Display (xk+1, yk+1, white).
6) Repeat Step (3) to (5) until
           xk+1=x2 AND /OR yk+1 =y2

7)STOP.
Midpoint Circle
Algorithm
Mid-point Circle Algorithm

 A method for direct distance comparison is
to test the halfway position between two
pixels to determine if this midpoint is inside
or outside the circle boundary.
 This method is more easily applied to
other conics, and for an integer circle
radius.
1) Accept the radius r and center (xc, yc).The
point of the circumference of a circle with
center as origin (x0, y0) =(0,r).

2) Calculate the initial decision parameter as
     Po =5/4 –r .

3) At each xk position starting at k=0.Perform
the following test.
If Pk <0 then,
 Xk+1= xk +1 and yk+1= yk
            Pk+1 = Pk +2xk +3

Otherwise, Pk >0
Xk+1= xk +1 and Yk+1= yk -1
            Pk+1= Pk +2( xk - yk ) +5

4) Determine the symmetric points in other 7
octants.
5) Translate each calculated pixel position by
T ( xk , yk ) and display the pixel
X= xk+1 + xc AND Y= yk+1 + yc
                        Put pixel ( x,y, white).

6) Repeat step (3) to step (5) until x>=y.

7)STOP.
BRESENHAM’S CIRCLE
ALGORITHM
1) Accept the radius r and center (xc, yc).The
point of the circumference of a circle with center
as origin (x0, y0) =(0,r).

2) Calculate the initial decision parameter as
     PO =3 – 2r.

3) At each xk position starting at k=0.Perform
the following test.
If Pk <0 then,
 Xk+1= xk +1 and yk+1= yk
               Pk+1 = Pk +4xk +6.
Otherwise, Pk > 0
Xk+1= xk +1 AND Yk+1= yk -1

            Pk+1= Pk +4( xk - yk ) +10

4) Determine the symmetric points in other 7
octants.
5) Translate each calculated pixel position by
T ( xk , yk ) and display the pixel
X= xk+1 + xc AND Y= yk+1 + yc
                        Put pixel ( x, y, white)
6) Repeat step (3) to step (5) until x>=y

7) STOP.
 The DDA algorithm is accomplished by taking
  unit step in one direction and calculating other.
 The Bresenham’s Algorithm finds the closest
  integer co-ordinate to the actual part.
 DDA algorithm uses floating point calculation.
 Bresenham’s uses integer point calculation.
 DDA is more accurate compared to
  Bresenhams.
 Circles and ellipses can be efficiently and
  accurately scan converted using midpoint
  methods.
 Bresenham’s line algorithm and the midpoint
  line algorithm methods are the most efficient.
THANK YOU

More Related Content

What's hot

Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
LOKENDRA PRAJAPATI
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
Ankit Garg
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
Mani Kanth
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive
SachiniGunawardana
 
Unit 3
Unit 3Unit 3
Unit 3
ypnrao
 
2D Transformations(Computer Graphics)
2D Transformations(Computer Graphics)2D Transformations(Computer Graphics)
2D Transformations(Computer Graphics)
AditiPatni3
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
shalinikarunakaran1
 
Computer Graphics - clipping
Computer Graphics - clippingComputer Graphics - clipping
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
Renita Santhmayora
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
Selvakumar Gna
 
Scaling
ScalingScaling
Scaling
Farwa Ansari
 
3D transformation and viewing
3D transformation and viewing3D transformation and viewing
3D transformation and viewing
abhishek1235010004
 
DDA algorithm
DDA algorithmDDA algorithm
DDA algorithm
Yash Patel
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
shalinikarunakaran1
 
Two dimensional viewing
Two dimensional viewingTwo dimensional viewing
Two dimensional viewingMohd Arif
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
Ummiya Mohammedi
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
Omprakash Chauhan
 
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
Ruchi Maurya
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unit
aravindangc
 

What's hot (20)

Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive
 
Unit 3
Unit 3Unit 3
Unit 3
 
2D Transformations(Computer Graphics)
2D Transformations(Computer Graphics)2D Transformations(Computer Graphics)
2D Transformations(Computer Graphics)
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
Computer Graphics - clipping
Computer Graphics - clippingComputer Graphics - clipping
Computer Graphics - clipping
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Scaling
ScalingScaling
Scaling
 
3D transformation and viewing
3D transformation and viewing3D transformation and viewing
3D transformation and viewing
 
DDA algorithm
DDA algorithmDDA algorithm
DDA algorithm
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
 
Two dimensional viewing
Two dimensional viewingTwo dimensional viewing
Two dimensional viewing
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unit
 

Viewers also liked

Modern Operating System Windows Server 2008
Modern Operating System  Windows Server 2008Modern Operating System  Windows Server 2008
Modern Operating System Windows Server 2008Sneha Chopra
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
Prianka Padmanaban
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsbhaveshbunk
 
system software and application software
system software and application softwaresystem software and application software
system software and application software
Tallat Satti
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
Kandarp Tiwari
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
Trinity Dwarka
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics Notes
Gurpreet singh
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Saikrishna Tanguturu
 
2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
System software
System softwareSystem software
System software
Harsha Sachdeva
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
Griffinder VinHai
 
SYSTEM SOFTWARE
SYSTEM SOFTWARESYSTEM SOFTWARE
SYSTEM SOFTWAREKak Yong
 
Computer Graphics Notes (B.Tech, KUK, MDU)
Computer Graphics Notes (B.Tech, KUK, MDU)Computer Graphics Notes (B.Tech, KUK, MDU)
Computer Graphics Notes (B.Tech, KUK, MDU)
Rajesh Kamboj
 

Viewers also liked (20)

E.s unit 4 and 5
E.s unit 4 and 5E.s unit 4 and 5
E.s unit 4 and 5
 
Modern Operating System Windows Server 2008
Modern Operating System  Windows Server 2008Modern Operating System  Windows Server 2008
Modern Operating System Windows Server 2008
 
Multimedia
MultimediaMultimedia
Multimedia
 
Data structures
Data structuresData structures
Data structures
 
E.s (2)
E.s (2)E.s (2)
E.s (2)
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
Embedded System
Embedded SystemEmbedded System
Embedded System
 
E.s unit 6
E.s unit 6E.s unit 6
E.s unit 6
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
system software and application software
system software and application softwaresystem software and application software
system software and application software
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics Notes
 
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
 
2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)2d/3D transformations in computer graphics(Computer graphics Tutorials)
2d/3D transformations in computer graphics(Computer graphics Tutorials)
 
System software
System softwareSystem software
System software
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
SYSTEM SOFTWARE
SYSTEM SOFTWARESYSTEM SOFTWARE
SYSTEM SOFTWARE
 
Computer Graphics Notes (B.Tech, KUK, MDU)
Computer Graphics Notes (B.Tech, KUK, MDU)Computer Graphics Notes (B.Tech, KUK, MDU)
Computer Graphics Notes (B.Tech, KUK, MDU)
 

Similar to Computer Graphics

Dda algo notes
Dda algo notesDda algo notes
Dda algo notes
shreeja asopa
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
Kokebe2
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
Kuntal Bhowmick
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
SanthiNivas
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithmsMohammad Sadiq
 
Unit 4 jwfiles
Unit 4 jwfilesUnit 4 jwfiles
Unit 4 jwfiles
Nv Thejaswini
 
Applications of Differential Calculus in real life
Applications of Differential Calculus in real life Applications of Differential Calculus in real life
Applications of Differential Calculus in real life
OlooPundit
 
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
Amol Gaikwad
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
54MahakBansal
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4Roziq Bahtiar
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
IndhuMcamphil
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
Alamelu
 
Solution set 3
Solution set 3Solution set 3
Solution set 3
慧环 赵
 
Graphs of the Sine and Cosine Functions Lecture
Graphs of the Sine and Cosine Functions LectureGraphs of the Sine and Cosine Functions Lecture
Graphs of the Sine and Cosine Functions Lecture
Froyd Wess
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
Ankit Garg
 
AJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdfAJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdf
BRNSS Publication Hub
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
ijceronline
 
Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniya
TutorialsDuniya.com
 

Similar to Computer Graphics (20)

Dda algo notes
Dda algo notesDda algo notes
Dda algo notes
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
 
Computer Graphics Unit 2
Computer Graphics Unit 2Computer Graphics Unit 2
Computer Graphics Unit 2
 
Lines and curves algorithms
Lines and curves algorithmsLines and curves algorithms
Lines and curves algorithms
 
algorithm Unit 4
algorithm Unit 4 algorithm Unit 4
algorithm Unit 4
 
Unit 4 jwfiles
Unit 4 jwfilesUnit 4 jwfiles
Unit 4 jwfiles
 
Applications of Differential Calculus in real life
Applications of Differential Calculus in real life Applications of Differential Calculus in real life
Applications of Differential Calculus in real life
 
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
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
 
Open GL T0074 56 sm4
Open GL T0074 56 sm4Open GL T0074 56 sm4
Open GL T0074 56 sm4
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
 
OUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptxOUTPUT PRIMITIVES.pptx
OUTPUT PRIMITIVES.pptx
 
Solution set 3
Solution set 3Solution set 3
Solution set 3
 
Graphs of the Sine and Cosine Functions Lecture
Graphs of the Sine and Cosine Functions LectureGraphs of the Sine and Cosine Functions Lecture
Graphs of the Sine and Cosine Functions Lecture
 
Line drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniquesLine drawing algorithm and antialiasing techniques
Line drawing algorithm and antialiasing techniques
 
AJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdfAJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdf
 
International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Computer graphics notes 2 tutorials duniya
Computer graphics notes 2   tutorials duniyaComputer graphics notes 2   tutorials duniya
Computer graphics notes 2 tutorials duniya
 

Computer Graphics

  • 1.
  • 2.  Output primitives are the basic geometric structures which facilitate or describe a scene/picture.  Example of these include: points, lines, curves (circles, conics etc), surfaces, fill colour, character string etc.
  • 3. In order to draw the primitive objects, one has to first scan convert the object. Scan convert: Refers to the operation of finding out the location of pixels and then setting the values of corresponding bits, in the graphic memory, to the desired intensity code.
  • 4.
  • 5. y means that for a unit (1) change in x m x there is m-change in y. x 1 means that for a unit (1) change in y y m there is 1/m change in x. 5
  • 6. Uses differential equation of the line : m If slope |m| 1 then increment x in steps of 1 pixel and find corresponding y-values. If slope |m| 1 then increment y in steps of 1 pixel and find corresponding x-values.                 step through in x step through in y 6
  • 7.  A line with positive slope (Left to Right) If m <= 1, sample at unit x intervals (Δx = 1) and compute successive y values as: yk+1 = yk + m. If m >1, sample at unit y intervals (Δy =1) and compute successive x values as: xk+1 = xk + 1/m.
  • 8.  A line with positive slope (Right to Left) If m <= 1, sample at unit x intervals (Δx =-1) and compute successive y values as: yk+1 = yk – m If m >1, sample at unit y intervals (Δy = -1) and compute successive x values as: xk+1 = xk - 1/m
  • 9.  A line with negative slope (Left to Right) If |m| <= 1, sample at unit x intervals (Δx = 1) and compute successive y values as: yk+1 = yk + m If |m| >1, sample at unit y intervals (Δy =-1) and compute successive x values as: xk+1 = xk - 1/m
  • 10.  A line with negative slope (Right to Left) If |m| <=1, sample at unit x intervals (Δx =1) and compute successive y values as: yk+1 = yk - m If |m| >1, sample at unit y intervals (Δy =1) and compute successive x values as: xk+1 = xk + 1/m
  • 11. 1) Accept the end point co-ordinates of the line segment AB ie A(x1,x2) and B(x2,y2). 2) Calculate dx and dy. 3) If abs(dx)>=abs(dy) then , Step=dx else Step=dy.
  • 12. 4) Let x increment = dx/Step ; Let y increment = dy/Step. 5) Display the pixels at standing portion put pixel (x,y,white). 6) Compute the next co-ordinate position along the line path xk+1 = xk + x increment yk+1 = yk + y increment Put Pixel(xk+1 , yk+1 ,white).
  • 13. 7) If xk+1=x2 OR / AND yk+1=y2 then STOP else go to Step (4).
  • 14.
  • 15. 1) In Bresenham’s Line Drawing Algorithm the pixel positions along a line path are obtained by determining the pixel i.e nearer the line at each step. 2) It is an efficient raster line generation algorithm.
  • 16. 1) Accept the end point co-ordinates of the line segment AB ie A(x1,x2) and B(x2,y2). 2) Calculate dx and dy. 3) If abs(dy)<=abs(dx) ie slope |m|<=1 (a) Compute initial decision parameter Po= 2abs(dy)-abs(dx).
  • 17. (b) At each xk position perform the following if Pk <0 i.e d1< d2 then, x increment=dx/abs(dx) AND y increment=0 Pk+1= Pk + 2abs(dy) else, Pk >0 ie d1>d2 X increment =dx/abs(dx) Y increment =dy/abs(dy) Pk+1= Pk +2abs(dy)-2abs(dx).
  • 18. 4) If abs(dy) > abs(dx) ie slope |m|>1 (a) Compute initial decision parameter Po= 2abs(dx)-abs(dy) (b) At each xk position,perform the following if Pk < 0 i.e d1 < d2 then x increment=0 y increment=dy/abs(dy) Pk+1= Pk + 2abs(dx)
  • 19. Else, Pk >0 ie d1>d2 X increment=dx/abs(dx) Y increment=dy/abs(dy) Pk+1= Pk +2abs(dx)-2abs(dy). 5) Calculate : xnext = xk + x increment ynext = yk + y increment. Display (xk+1, yk+1, white).
  • 20. 6) Repeat Step (3) to (5) until xk+1=x2 AND /OR yk+1 =y2 7)STOP.
  • 22. Mid-point Circle Algorithm  A method for direct distance comparison is to test the halfway position between two pixels to determine if this midpoint is inside or outside the circle boundary.  This method is more easily applied to other conics, and for an integer circle radius.
  • 23. 1) Accept the radius r and center (xc, yc).The point of the circumference of a circle with center as origin (x0, y0) =(0,r). 2) Calculate the initial decision parameter as Po =5/4 –r . 3) At each xk position starting at k=0.Perform the following test.
  • 24. If Pk <0 then, Xk+1= xk +1 and yk+1= yk Pk+1 = Pk +2xk +3 Otherwise, Pk >0 Xk+1= xk +1 and Yk+1= yk -1 Pk+1= Pk +2( xk - yk ) +5 4) Determine the symmetric points in other 7 octants.
  • 25. 5) Translate each calculated pixel position by T ( xk , yk ) and display the pixel X= xk+1 + xc AND Y= yk+1 + yc Put pixel ( x,y, white). 6) Repeat step (3) to step (5) until x>=y. 7)STOP.
  • 27. 1) Accept the radius r and center (xc, yc).The point of the circumference of a circle with center as origin (x0, y0) =(0,r). 2) Calculate the initial decision parameter as PO =3 – 2r. 3) At each xk position starting at k=0.Perform the following test.
  • 28. If Pk <0 then, Xk+1= xk +1 and yk+1= yk Pk+1 = Pk +4xk +6. Otherwise, Pk > 0 Xk+1= xk +1 AND Yk+1= yk -1 Pk+1= Pk +4( xk - yk ) +10 4) Determine the symmetric points in other 7 octants.
  • 29. 5) Translate each calculated pixel position by T ( xk , yk ) and display the pixel X= xk+1 + xc AND Y= yk+1 + yc Put pixel ( x, y, white) 6) Repeat step (3) to step (5) until x>=y 7) STOP.
  • 30.  The DDA algorithm is accomplished by taking unit step in one direction and calculating other.  The Bresenham’s Algorithm finds the closest integer co-ordinate to the actual part.  DDA algorithm uses floating point calculation.  Bresenham’s uses integer point calculation.  DDA is more accurate compared to Bresenhams.
  • 31.  Circles and ellipses can be efficiently and accurately scan converted using midpoint methods.  Bresenham’s line algorithm and the midpoint line algorithm methods are the most efficient.
  • 32.