cmsc427 points, polylines and polygons
TRANSCRIPT
• Intheory,smoothcurve:
• Inreality,piecewisediscreteapproxima@on:
Issue: discretization of continuous curve
Points, polylines and polygons
Points Also called vertices
Polyline Continuous sequence
of line segments
Polygon Closed sequence of line segments
Polygon properties I
• Simplenoself-intersec@onsnoduplicatepoints
• Non-simple self-intersections duplicate points
Polygon properties II
• ConvexpolygonAnytwopointsinpolygoncanbeconnectedbyinsideline
• Concave polygon Not true of all point pairs inside polygon
Point in polygon problem
IsPinsideoroutsidethepolygon?
Case1 Case2
Case3
1 crossing
3 crossings
2 crossings
Point in polygon problem
IsPinsideoroutsidethepolygon?Oddcrossings–insideEvencrossings–outside
Case1 Case2
Case3
1 crossing
3 crossings
2 crossings
Algorithmicefficiency?
• Polygoncollision• Returnyes/no
• Polygonintersec@on• Returnpolygonofintersec@on(P)
• Polygonrasteriza@on• Returnpixelsthat intersect
• Polygonwindingdirec@on• Returnclockwise(CW)orcounterclockwise(CCW)
Other polygon problems
Why triangles …
Whytriangles?1.Easiestpolygontorasterize2.Polygonswithn>3canbenon-planar3.Ligh@ngcomputa@onsin3Dhappenatver@ces-morever@cesgivesmootherillumina@oneffects
Theorem: Every simple polygon has a triangulation
• Proof by induc-on Base case: n = 3 Induc-ve case A) Pick a convex corner p. Let q and r be pred and succ ver-ces. B) If qr a diagonal, add it. By induc-on, the smaller polygon has a triangula-on. C) If qr not a diagonal, let z be the reflex vertex farthest to qr inside △pqr. D) Add diagonal pz; subpolygons on both sides have triangula-ons.
• Parametriccurves1. Modelobjectsbyequa@on2. Complexshapesfromfewvalues3. Modelingarbitraryshapecanbehard
• Polylines1. Modelobjectsbydatapoints2. Complexshapesneedaddi@onaldata3. Canmodelanyshapeapproximately
• Lookingforward• Usepolylinestocontrolgeneralparametriccurves• B-splines,NURBS
Parametric curves vs. polylines
1. Defini@onsofpolylineandpolygons2. Polylinesandpolygonsaspiecewise
discreteapproxima@onstosmoothcurves3. Defini@onsofproper@esofpolygons
(simple/non-simple,concave/convex)4. Defini@onofpoint-in-polygonproblemand
crossingsolu@on5. Trianglesaregood(simplestpolygon,
alwaysplanar,easytorasterize,moreisgood)
6. Defini@onofpolygontriangula@on(don’tneedtoknowthetheoremyet)
What you should know after today