Download presentation
Published byChester Robertson Modified over 9 years ago
1
Classes of Polygons Planar polygons Non-planar polygons Simple
Convex Star-shaped Non-simple Non-planar polygons
2
Planar Polygons Definition:
All points of the polygon must lie within a plane.
3
Simple Polygons Definition
A polygon P is simple, if no two non-consecutive edges intersect. Simple Not simple
4
Simple Polygons The polygon interior is well-defined. If we traverse the polygon in a counter-clockwise direction, the interior is always to our left. Simple Not simple
5
Convex Polygons Definition
A polygon P is convex, if and only if, for any pair of points x,y, in P the line segment between x and y lies entirely in P. Every point can see every other point. Convex Concave
6
Convex Polygons Alternative Definition
Going from point Pi to Pi+1 involves making only left had turns. Implies that the polygon vertices are ordered in a counter-clockwise fashion. Implies cross-products of adjacent edges are positive. Convex polygons are of course, simple.
7
Triangles Any three non-colinear points determine a triangle.
Planar Convex Cross products can determine the normal (A,B,C)T to the triangle (plane). Plane: Ax + By + Cz + D = 0, where D can be solved using any of the three points.
8
Star-Shaped Polygons Definition
A star-shaped polygon, P, is a simple polygon which contains a non-empty set, K of points, such that every point in K is visible from any other point in the polygon. The set K is called the kernel of P. A convex polygon is a star-shaped polygon whose kernel is equal to the interior of P.
9
Star-Shaped Polygons The kernel can easily be determined by clipping the polygon to the half-planes defined by each edge.
10
Non-Planar Polygons In 3D computer graphics, we often have to deal with non-planar polygons. Longitude/latitude grid on a sphere. Polygonal approximations to smooth surfaces.
11
More Polygonal Definitions
Convex Hull – The convex hull of a polygon P, is the smallest convex polygon that contains P. Diagonal – A line segment lying entirely inside polygon P and joining two non-consecutive vertices pi and pk Principal vertex – A vertex pi of simple polygon P is called a principal vertex if the diagonal (pi-1, pi+1) intersects the boundary of P only at pi-1 and pi+1. Not a principal vertex diagonal Convex hull
12
More Polygonal Definitions
Ear – A principal vertex pi of a simple polygon P is called an ear if the diagonal (pi-1, pi+1) lies in the interior of P. Mouth – A principal vertex pi of a simple polygon P is called a mouth if the diagonal (pi-1, pi+1) lies in the exterior of P.
13
Some Theorems One-Mouth Theorem – Except for convex polygons, every simple polygon has at least one mouth. Two-Ears Theorem – Except for triangles, every simple polygon has at least two non-overlapping ears.
14
Polygonal Tricks Area Test for concave/convex.
15
Polygonal Area Convex polygons
Take any point inside the polygon and compute the area of all triangles formed with one edge and the point. Actually, we can take any point and do this, if we give the area of the triangles a signed value.
16
Triangle Area The good old cross product:
||AB|| = area of parallel-piped = 2*area of triangle. For 2D triangles, the magnitude is the absolute value of the z-component. B A Area = ½AxBy-AyBx
17
Polygonal Area Vectors: Choose the point to be the origin, then the vectors are simply the points on the polygon. Convex polygon Area =
18
Polygonal Area Wow!!! This actually works for any simple polygon.
19
Convexity Test We can easily determine whether a polygon is convex or concave, and whether it is order clockwise or counter-clockwise. Examine the cross products between adjacent edges. If they are all the same sign, then the polygon is convex, otherwise it is concave. If the area computed as before is positive, then the ordering is in a counter-clockwise fashion.
20
Efficient Scan-Conversion
Convex polygons Triangles
21
Scan-Converting Convex Polygons
What is the intersection of a line with a convex polygon?
22
Scan-Converting Convex Polygons
Any line will intersect a convex polygon in at most 2 locations. This greatly simplifies our active edge table. Simply keep a current x-left and an x-right intersection. Update the slopes on scan- lines where new edges start.
23
Scan-Converting Triangles
Special cases One horizontal edge. For y=ymin to ymax Draw from x-left to x-right Update x-left and x-right
24
Scan-Converting Triangles
General cases: Divide into two special cases. One quick split at middle vertex and 2 very tight for loops.
25
Triangulations To avoid problems with non-planar polygons, as well as simplify the scan-conversion process, we can triangulate a polygon before we rasterize it. A triangulation of a simple polygon P consists of n-3 diagonals, or n-2 triangles.
26
Triangulation Algorithms
Convex polygons are trivial. Star-shaped polygons can also be dealt with rather easily. Can also use splitting algorithms as described in the book. These add additional vertices, but may be simpler.
27
Triangulating Convex Polygons
Pick any vertex i. Connect the vertices (i,k,k+1) for all k i, i-1.
28
Triangulating Concave Polygons
While polygon P is not a triangle Find an ear of P. Remove the ear from P.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.