CMSC427 Points, polylines and polygons Issue: discretization of - - PowerPoint PPT Presentation

cmsc427 points polylines and polygons issue
SMART_READER_LITE
LIVE PREVIEW

CMSC427 Points, polylines and polygons Issue: discretization of - - PowerPoint PPT Presentation

CMSC427 Points, polylines and polygons Issue: discretization of continuous curve In theory, smooth curve: In reality, piecewise discrete approxima@on: Modeling with discrete approximations Increase fidelity with more points Points,


slide-1
SLIDE 1

CMSC427 Points, polylines and polygons

slide-2
SLIDE 2
  • In theory, smooth curve:
  • In reality, piecewise discrete approxima@on:

Issue: discretization of continuous curve

slide-3
SLIDE 3

Modeling with discrete approximations Increase fidelity with more points

slide-4
SLIDE 4

Points, polylines and polygons

Points

Also called vertices

Polyline

Continuous sequence

  • f line segments

Polygon

Closed sequence

  • f line segments
slide-5
SLIDE 5

Polygon properties I

  • Simple

no self-intersec@ons no duplicate points

  • Non-simple


self-intersections
 duplicate points

slide-6
SLIDE 6

Polygon properties II

  • Convex polygon

Any two points in polygon can

be connected by inside line

  • Concave polygon


Not true of all point pairs inside polygon

slide-7
SLIDE 7

Point in polygon problem

Is P inside or outside the polygon? Case 1 Case 2 Case 3

slide-8
SLIDE 8

Point in polygon problem

Is P inside or outside the polygon? Case 1 Case 2 Case 3

1 crossing 3 crossings 2 crossings

slide-9
SLIDE 9

Point in polygon problem

Is P inside or outside the polygon? Odd crossings – inside Even crossings – outside

Case 1 Case 2 Case 3

1 crossing 3 crossings 2 crossings

Algorithmic efficiency?

slide-10
SLIDE 10

Point in polygon problem

Is P inside or outside the polygon?

slide-11
SLIDE 11

Point in polygon problem

Is P inside or outside the polygon?

slide-12
SLIDE 12
  • Polygon collision
  • Return yes/no
  • Polygon intersec@on
  • Return polygon of intersec@on (P)
  • Polygon rasteriza@on
  • Return pixels that

intersect

  • Polygon winding direc@on
  • Return clockwise (CW) or

counterclockwise (CCW)

Other polygon problems

slide-13
SLIDE 13

Moral: easier with simple, convex, low count polygons

Vs

slide-14
SLIDE 14

Triangular mesh

Vs

slide-15
SLIDE 15

Why triangles …

Why triangles?

  • 1. Easiest polygon to rasterize
  • 2. Polygons with n > 3 can be

non-planar

  • 3. Ligh@ng computa@ons in 3D

happen at ver@ces - more ver@ces give smoother illumina@on effects

slide-16
SLIDE 16

Polygon triangulation

slide-17
SLIDE 17

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.

slide-18
SLIDE 18
  • Parametric curves
  • 1. Model objects by equa@on
  • 2. Complex shapes from few values
  • 3. Modeling arbitrary shape can be hard
  • Polylines
  • 1. Model objects by data points
  • 2. Complex shapes need addi@onal data
  • 3. Can model any shape approximately
  • Looking forward
  • Use polylines to control general parametric curves
  • B-splines, NURBS

Parametric curves vs. polylines

slide-19
SLIDE 19
  • 1. Defini@ons of polyline and polygons
  • 2. Polylines and polygons as piecewise

discrete approxima@ons to smooth curves

  • 3. Defini@ons of proper@es of polygons

(simple/non-simple, concave/convex)

  • 4. Defini@on of point-in-polygon problem and

crossing solu@on

  • 5. Triangles are good (simplest polygon,

always planar, easy to rasterize, more is good)

  • 6. Defini@on of polygon triangula@on (don’t

need to know the theorem yet) What you should know after today