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

Lecture2 E

The document describes the midpoint ellipse algorithm and scan-line polygon fill algorithm. The midpoint ellipse algorithm uses implicit equations to determine regions and incrementally moves to the midpoint of each region to trace out an ellipse. The scan-line polygon fill algorithm works by finding the intersections of polygon edges with a scan line, sorting the intersections, and filling pixels between interior intersections to fill the polygon area.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Lecture2 E

The document describes the midpoint ellipse algorithm and scan-line polygon fill algorithm. The midpoint ellipse algorithm uses implicit equations to determine regions and incrementally moves to the midpoint of each region to trace out an ellipse. The scan-line polygon fill algorithm works by finding the intersections of polygon edges with a scan line, sorting the intersections, and filling pixels between interior intersections to fill the polygon area.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

Scan Conversion

Midpoint Ellipse Algorithm


 Implicit equation is: F(x,y) = b2x2 + a2y2 – a2b2 = 0
 We have only 4-way symmetry (-x ,y ) 1 1 (x1,y1)

 There exists two regions (-x ,y )


2 2 (x2,y2)

 In Region 1 dx > dy
(-x2,-y2) (x2,-y2)
 Increase x at each step
(-x1,-y1) (x1,-y1)
 y may decrease
 In Region 2 dx < dy E
Tangent
 Decrease y at each step Slope = -1 Gradient
 x may increase SE Vector
 At region boundary: Region 1
Region 2 S SE

dy
2  x  b2  2  y  a2  0
dx dy
In Region 1 1
dy b2  x dx
  2
dx a y b2  x  a 2  y
Midpoint Ellipse Algorithm
 In region 1

d  F ( x p  1, y p  12 )
( x p  1, y p  12 ) ( x p  2, y p  12 )
 b ( x p  1)  a ( y p  )  a b
2 2 2 1 2
2
2 2

P=(xp, yp) E
if d  0 then move to E ME
yp
M
d new  F ( x p  1, y p ) SE
MSE
yp – 1

 b 2 ( x p  1) 2  a 2 ( y p ) 2  a 2b 2 yp – 2
xp xp+1 xp+2
if d  0 then move to SE ( x p  2, y p  32 )

Previous

Current

Next
d new  F ( x p  1, y p  1)
 b 2 ( x p  1) 2  a 2 ( y p  1) 2  a 2b 2
Midpoint Ellipse Algorithm
 In region 2

Previous

Current
d  F ( x p  12 , y p  1)

Next
 b 2 ( x p  12 ) 2  a 2 ( y p  1) 2  a 2b 2 xp xp+1 xp+2

P=(xp, yp)
if d  0 then move to S yp

d new  F ( x p , y p  1) S SE
yp – 1
M

 b 2 ( x p ) 2  a 2 ( y p  1) 2  a 2b 2 MS MSE
yp – 2
( x p  , y p  1)
1
2
if d  0 then move to SE
( x p  12 , y p  2) ( x p  2 , y p  2)
3

d new  F ( x p  1, y p  1)
 b 2 ( x p  1) 2  a 2 ( y p  1) 2  a 2b 2
Filling Polygons
 So we can figure out how to draw lines,
circles and ellipse
 How do we go about drawing polygons?
 We use an incremental algorithm known as
the scan-line algorithm
Scan-Line Polygon Fill Algorithm
10 Scan Line

0
2 4 6 8 10 12 14 16
Scan-Line Polygon Fill Algorithm
 The basic scan-line algorithm is as follows:
 Find the intersections of the scan line with all
edges of the polygon
 Sort the intersections by increasing x
coordinate
 Fill in all pixels between pairs of intersections
that lie interior to the polygon
Scan-Line Polygon Fill Algorithm (cont…)

You might also like