Top Banner
CMSC427 Points, polylines and polygons
19

CMSC427 Points, polylines and polygons

Oct 29, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CMSC427 Points, polylines and polygons

CMSC427Points,polylinesandpolygons

Page 2: CMSC427 Points, polylines and polygons

•  Intheory,smoothcurve:

•  Inreality,piecewisediscreteapproxima@on:

Issue: discretization of continuous curve

Page 3: CMSC427 Points, polylines and polygons

Modeling with discrete approximations

Increase fidelity with more points

Page 4: CMSC427 Points, polylines and polygons

Points, polylines and polygons

Points Also called vertices

Polyline Continuous sequence

of line segments

Polygon Closed sequence of line segments

Page 5: CMSC427 Points, polylines and polygons

Polygon properties I

•  Simplenoself-intersec@onsnoduplicatepoints

• Non-simple self-intersections duplicate points

Page 6: CMSC427 Points, polylines and polygons

Polygon properties II

•  ConvexpolygonAnytwopointsinpolygoncanbeconnectedbyinsideline

• Concave polygon Not true of all point pairs inside polygon

Page 7: CMSC427 Points, polylines and polygons

Point in polygon problem

IsPinsideoroutsidethepolygon?

Case1 Case2

Case3

Page 8: CMSC427 Points, polylines and polygons

Point in polygon problem

IsPinsideoroutsidethepolygon?

Case1 Case2

Case3

1 crossing

3 crossings

2 crossings

Page 9: CMSC427 Points, polylines and polygons

Point in polygon problem

IsPinsideoroutsidethepolygon?Oddcrossings–insideEvencrossings–outside

Case1 Case2

Case3

1 crossing

3 crossings

2 crossings

Algorithmicefficiency?

Page 10: CMSC427 Points, polylines and polygons

Point in polygon problem

IsPinsideoroutsidethepolygon?

Page 11: CMSC427 Points, polylines and polygons

Point in polygon problem

IsPinsideoroutsidethepolygon?

Page 12: CMSC427 Points, polylines and polygons

• Polygoncollision•  Returnyes/no

• Polygonintersec@on•  Returnpolygonofintersec@on(P)

• Polygonrasteriza@on•  Returnpixelsthat intersect

• Polygonwindingdirec@on•  Returnclockwise(CW)orcounterclockwise(CCW)

Other polygon problems

Page 13: CMSC427 Points, polylines and polygons

Moral: easier with simple, convex, low count polygons

Vs

Page 14: CMSC427 Points, polylines and polygons

Triangular mesh

Vs

Page 15: CMSC427 Points, polylines and polygons

Why triangles …

Whytriangles?1.Easiestpolygontorasterize2.Polygonswithn>3canbenon-planar3.Ligh@ngcomputa@onsin3Dhappenatver@ces-morever@cesgivesmootherillumina@oneffects

Page 16: CMSC427 Points, polylines and polygons

Polygon triangulation

Page 17: CMSC427 Points, polylines and polygons

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.

Page 18: CMSC427 Points, polylines and polygons

• Parametriccurves1.  Modelobjectsbyequa@on2.  Complexshapesfromfewvalues3.  Modelingarbitraryshapecanbehard

• Polylines1.  Modelobjectsbydatapoints2.  Complexshapesneedaddi@onaldata3.  Canmodelanyshapeapproximately

•  Lookingforward•  Usepolylinestocontrolgeneralparametriccurves•  B-splines,NURBS

Parametric curves vs. polylines

Page 19: CMSC427 Points, polylines and polygons

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