0% found this document useful (0 votes)
6 views4 pages

Polygon Graphics Techniques Guide

Uploaded by

deathland2352
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Polygon Graphics Techniques Guide

Uploaded by

deathland2352
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Detailed Explanation with Examples

1. Fill-Area Primitives

Definition: An area in a graphical image filled with a solid color or pattern. Typically represented as

polygons with at least three vertices connected by edges.

Types of Polygons:

- Convex: All interior angles <= 180 degrees. Easier for graphics libraries like OpenGL to process.

- Concave: At least one interior angle > 180 degrees. Often split into convex polygons for simplicity.

Example: A rectangle (convex) and a star-shaped figure (concave).

2. Splitting Concave Polygons

Splitting concave polygons into convex components simplifies filling and processing.

Technique: Use a vector cross-product to find edges that need splitting. Extend edges to form new

vertices.

Example: For a star-shaped polygon, splitting results in multiple triangles.

3. Inside-Outside Tests

Purpose: Determine whether a point lies inside or outside a polygon.

- Odd-Even Rule: Draw a line from the point to infinity. Count edge crossings:

- Odd: Point is inside.

- Even: Point is outside.


- Nonzero Winding Rule: Consider edges as vectors. Add/subtract 1 based on edge orientation

(right-to-left or left-to-right). Nonzero result implies the point is inside.

Example: For a pentagon:

- Odd-Even Rule: A point inside crosses 3 edges.

- Nonzero Winding Rule: Adding vectors gives a nonzero result.

4. Polygon Tables

Used to store 3D objects as polygonal meshes:

- Vertex Table: Lists coordinates of each vertex.

- Edge Table: Links vertices to edges.

- Surface-Facet Table: Links edges to polygon surfaces.

Example: For a cube:

- Vertex table: (0, 0, 0), (1, 0, 0), ...

- Edge table: [(1, 2), (2, 3), ...].

- Surface-facet table: [(1, 2, 3, 4), ...].

5. Polygon Color Filling

Filling involves highlighting all interior pixels.

- Seed Fill:

- Picks a seed point inside the polygon.

- Expands outward until the boundary is reached.

- Types: 4-connected and 8-connected.


- Scan Line Algorithm:

- Identifies intersections of scan lines with edges.

- Fills between intersection pairs.

Example: Fill a triangle:

- Seed Fill: Starts from a center point.

- Scan Line: Scans from bottom to top edge.

6. Text and Characters

OpenGL lacks text routines but uses GLUT for rendering.

- Bitmap Fonts:

- Simple pixel grids.

- Fast rendering but not scalable.

- Example: glutBitmapCharacter(GLUT_BITMAP_9_BY_15, 'A').

- Stroke Fonts:

- Line/curve primitives.

- Scalable with transformations like glScalef.

- Example: glutStrokeCharacter(GLUT_STROKE_ROMAN, 'A').

Comparison: Bitmap fonts are faster but less flexible. Stroke fonts are slower but scalable.

Example Application:

Design a graphical interface with:

- Polygons: Draw a house using convex polygons for walls and roof.

- Filling: Use the scan line algorithm to color the house walls.
- Text: Display "My House" using stroke fonts for scalability.

You might also like