scan conversion of polygons n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Scan Conversion of Polygons PowerPoint Presentation
Download Presentation
Scan Conversion of Polygons

Loading in 2 Seconds...

play fullscreen
1 / 70

Scan Conversion of Polygons - PowerPoint PPT Presentation


  • 145 Views
  • Uploaded on

Scan Conversion of Polygons. Dr. Scott Schaefer. Drawing Rectangles. Which pixels should be filled?. Drawing Rectangles. Is this correct?. Drawing Rectangles. What if two rectangles overlap?. Drawing Rectangles. Is this correct?. Drawing Rectangles. Overlap!!!. Is this correct?.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Scan Conversion of Polygons' - noma


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
scan conversion of polygons

Scan Conversion of Polygons

Dr. Scott Schaefer

drawing rectangles
Drawing Rectangles

Which pixels should be filled?

drawing rectangles1
Drawing Rectangles

Is this correct?

drawing rectangles2
Drawing Rectangles

What if two rectangles overlap?

drawing rectangles3
Drawing Rectangles

Is this correct?

drawing rectangles4
Drawing Rectangles

Overlap!!!

Is this correct?

drawing rectangles5
Drawing Rectangles

Solution: Exclude pixels on top and right

drawing rectangles6
Drawing Rectangles

Artifacts are possible

general polygons basic idea
General Polygons – Basic Idea
  • Intersect scan lines with edges
  • Find ranges along x
  • Fill interior of those

ranges

Don’t fill top/right

Edges may NOT match

with line drawing algo

general polygons basic idea1
General Polygons – Basic Idea

Use coherence to speed up

  • Intersect scan lines with edges
  • Find ranges along x
  • Fill interior of those

ranges

Don’t fill top/right

Edges may NOT match

with line drawing algo

general polygons basic idea2
General Polygons – Basic Idea

Use coherence to speed up

  • Intersect scan lines with edges
  • Find ranges along x
  • Fill interior of those

ranges

Edges intersection one scan line are mostly same as those intersecting previous scan line

general polygons basic idea3
General Polygons – Basic Idea

Use coherence to speed up

  • Intersect scan lines with edges
  • Find ranges along x
  • Fill interior of those

ranges

The x-value of an intersection with one scan line is close to the intersection with the previous one

general polygons data structures
General Polygons – Data Structures
  • Edge:

maxY:

currentX:

xIncr:

Edge

maxY

currentX

xIncr

general polygons data structures1
General Polygons – Data Structures
  • Edge:

maxY:

currentX:

xIncr:

Edge

maxY

currentX

xIncr

Horizontal edges will not be used!!!

general polygons data structures2
General Polygons – Data Structures
  • Active Edge Table:

Store a linked-list per scan-line.

Insert edges into table at scan-line associated with lowest end-point.

Scan Lines

Edges

general polygons data structures3
General Polygons – Data Structures
  • Active Edge List:

List of all edges intersecting current scan-line sorted by their x-values

Edges

general polygons algorithm
General Polygons – Algorithm

line = 0

While (line < height )

Add edges to Active Edge List from Active Edge Table starting at line

Remove edges that end at line

Fill pixels

Increment x-values on edges in Active Edge List

Increment line

general polygons example
General Polygons – Example

C

Active Edge Table

B

D

G

Active Edge List

F

E

A

general polygons example1
General Polygons – Example

C

Active Edge Table

B

D

G

AB

Active Edge List

F

E

A

general polygons example2
General Polygons – Example

C

Active Edge Table

B

BC

D

G

AB

Active Edge List

F

E

A

general polygons example3
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

AB

Active Edge List

F

E

A

general polygons example4
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

ED

AB

Active Edge List

F

E

A

general polygons example5
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

ED

AB

Active Edge List

F

E

A

general polygons example6
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

Active Edge List

F

E

A

general polygons example7
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

A

general polygons example8
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

AG

A

maxY

currentX

xIncr

general polygons example9
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

AG

FG

ED

A

maxY

currentX

xIncr

general polygons example10
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

AG

FG

ED

A

maxY

currentX

xIncr

general polygons example11
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

AG

FG

ED

A

maxY

currentX

xIncr

general polygons example12
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

AG

FG

ED

A

maxY

currentX

xIncr

general polygons example13
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

AG

FG

ED

A

maxY

currentX

xIncr

general polygons example14
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

ED

A

maxY

currentX

xIncr

general polygons example15
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

ED

A

maxY

currentX

xIncr

general polygons example16
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

ED

A

maxY

currentX

xIncr

general polygons example17
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

ED

A

maxY

currentX

xIncr

general polygons example18
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

ED

CD

A

maxY

currentX

xIncr

general polygons example19
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

ED

CD

A

maxY

currentX

xIncr

general polygons example20
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

CD

A

maxY

currentX

xIncr

general polygons example21
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

CD

A

maxY

currentX

xIncr

general polygons example22
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

BC

CD

A

maxY

currentX

xIncr

general polygons example23
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

AB

BC

CD

A

maxY

currentX

xIncr

general polygons example24
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

BC

CD

A

maxY

currentX

xIncr

general polygons example25
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

BC

CD

A

maxY

currentX

xIncr

general polygons example26
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

BC

CD

A

maxY

currentX

xIncr

general polygons example27
General Polygons – Example

C

Active Edge Table

B

BC

D

CD

G

FG

ED

AB

AG

Active Edge List

F

E

BC

CD

A

maxY

currentX

xIncr

general polygons problems
General Polygons – Problems
  • Sliver polygons may not be drawn correctly
  • No simple solution
  • Long, thin triangles

cause problems

  • Want triangles with

good aspect ratio

(close to equilateral)

boundary fill
Boundary Fill
  • Start with drawn outline of a polygon and an interior point
  • Recursively recolor outward from that point
    • If neighbor different, then recolor and recur
  • Everything within the boundary is changed to that color
boundary fill1
Boundary Fill
  • How to define a neighbor?

8-connected

4-connected

flood fill
Flood Fill
  • Start with a point
  • Define color under that point as the interior color
  • Recursively recolor outward from that point
    • If neighbor is interior color, then recolor and recur
  • Contiguous regions of the same color are recolored
opengl drawing polygons

GL_POLYGON

GL_TRIANGLES

GL_QUADS

OpenGL: Drawing Polygons

GL_TRIANGLE_FAN

  • Lots of different primitives supported
  • GPU only draws triangles
    • OpenGL triangulates all polygons
    • Problems with concave polygons!
  • How data is passed to GPU makes a significant difference in speed

GL_QUAD_STRIP

GL_TRIANGLE_STRIP

performance
Performance

Frames per second displaying a 413,236 triangle model. CPU was an Intel Core 2 67001 or Core i7 9402.