This action might not be possible to undo. Are you sure you want to continue?

Filled area primitives

**Approaches to area filling
**

Two approaches to area filling:

Determine the boundaries of an object and fill accordingly scan line approach Start from an interior position in the object and keep on filling till the boundary is reached boundary filling approach

Scan line approach appropriate for primitive shapes such as: polygons, circles, ellipses etc. Boundary filling approach is appropriate for images with complex objects and in interactive painting systems.

**Scan-Line polygon fill algorithm
**

For each scan-line crossing a polygon, the algorithm locates the intersection points of the scan line with the polygon edges. The intersection points are stored from left to right, and the corresponding frame buffer positions between each intersection pair are set to the specified fill colour. Polygon is considered as a set of edges and vertices.

Example

Move scan-line by scan-line and store the x-coordinates of the intersections for each scan-line

1

**Cases Problem: Intersecting vertices
**

If a vertex is a local minimum or a local maximum, then no special treatment is necessary. If a scan line intersects a vertex that is joined by two monotonically increasing or decreasing edges, getting two intersection points at the vertex will cause problems SOLUTION: record only one intersection point at the vertex. Horizontal edges are ignored

Example

V3 Last scan line e2 e3 V4 V2 V7 a e1 b e7 c e6 V6 V1 e5 V5 First scan line d y e4

**The Edge List
**

Edge E1 E7 E4 E6 E2 E3 ymin y1 y1 y5 y6 y2 y4 X-coordinate of vertex with y = ymin y2 – 1 X1 ymax y7 y4 – 1 y7 y3 y3 X1 X5 X6 X2 X4 1/m 1/m1 1/m7 1/m4 1/m6 1/m2 1/m3

2

**The Edge List
**

Each non-horizontal row occupies one record. The rows are sorted according to ymin. Information stored in each row includes:

y coordinates of the two endpoints of the edge, where ymin is the smaller value and ymax is the larger value. x coordinate of the endpoint whose y coordinate is ymin. Inverse of the edge slope.

**How this works?
**

Edges in the edge list become active when the y-coordinate of the current scan-line matches their ymin value. Only active edges are involved in the calculation of the intersection points. The first intersection point between an active edge and a scan line is always the lower endpoint of the edge, whose coordinates are stored in the edge list.

**Additional intersection points
**

Additional intersection points between an edge and successive scan lines can be calculated incrementally. If the edge intersects the current scan line at (x, y), it intersects the next scan line at (x+1/m, y+1). For example:

Edge E7 intersects scan line y at point b, and so the next intersection point on scan line y+1 can be calculated as x = 1/m7 y = 1. The new value of x is added to the edge list.

8-Connected vs. 4-Connected

4 5 6

3

2 1 3

2 1 4

7

8

3

**Boundary Fill algorithm
**

Recursive algorithm. Takes a seed (x, y) which is an interior pixel. Checks to see if the pixel is a boundary or no. If no:

Fills the pixel. Makes a recursive call to itself.

The Algorithm

void boundaryFill4(int x, int y, int fill, int boundary) { int current; current = getPixel(x, y); if((current != boundary) && (current != fill)) { setColor(fill); setPixel(x, y); boundaryFill4(x+1, y, fill, boundary); boundaryFill4(x-1, y, fill, boundary); boundaryFill4(x, y+1, fill, boundary); boundaryFill4(x, y-1, fill, boundary); } }

Inputs

Seed (x, y). Fill colour. Boundary colour.

**Flood Fill Algorithm
**

Sometimes we want to fill in or re-colour an area that is not defined within a single colour boundary

The Algorithm

void floodFill4(int x, int y, int fillColor, int oldColor) { if(getPixel(x, y) == oldColor) { setColor(fillColor); setPixel(x, y); floodFill4(x+1, y, fillColor, oldColor); floodFill4(x-1, y, fillColor, oldColor); floodFill4(x, y+1, fillColor, oldColor); floodFill4(x, y-1, fillColor, oldColor); } }

4

- Solution
- Lecture 12
- lecture10&11
- Lecture 9
- Lecture+7
- Lecture+6
- Slope+Discussion
- Lecture+5
- Lecture+4
- Lecture+3
- Lecture+1+&+2
- space time ray tracing for animation
- Requirements Engineering and the Creative Process in the Video Game Industry
- Traditional cartoon style 3D animation
- Fractal physiology
- Fast algorithm for line rasterization by using slope 1
- Efficient anti-aliasing algorithm for computer generated images
- Creating pen-and-ink illustration using stroke morphing method
- An efficient line algorithm
- An analysis technique and an algorithm for line clipping
- Algorithms for graphics texture mapping
- thinning of arabic characters
- recognition of Urdu Script
- preprocessing for multifont arabic-persian ocr

Sign up to vote on this title

UsefulNot usefulFilling algos

Filling algos

- Surfaces
- 3D Studio Max Tutorial
- 7th Geometry Standard 3
- ShipConstructor_ShipCAM(SC2005)
- Tabla Numeracion DXF
- 05 Modeling
- computer notes - Filled Area Primitives II
- 038 mc7_12star
- digital topology
- MCS-053
- Ray Casting Algorithm
- Radio Number of Cube of a Path
- Geometry Handbook
- Infinity 2012
- Teknk menjawab soalan mathematcs pmr
- EmediKarimi_FirstSubmissionACC2012
- cr01
- M49AQuadraticSkills
- 978-1-58503-662-2-3
- ESP-r_data_doc
- Nicholas of Cusa Metaphysical Speculations
- Tutorial Blender 1
- 5 - Lecture - Vertex Buffers
- Tesi poligono P3G
- GSP Project
- AUCBE 3RD YEAR SYLLABUS
- Printing _Remeshing 2-D Elements - HM-3110
- dna9
- Model Checking and64 Bit Architectures.pdf
- Nonlinear Dynamic Response of Hardering, Softening and Elastoplastic SDOF Systems (Papazafeiropoulos, Et Al. 2015)
- Lecture 8

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.