PMC and Booleans - PowerPoint PPT Presentation

About This Presentation
Title:

PMC and Booleans

Description:

Point-Membership Classification Regularized Booleans between polygons Point-in-polygon test in 2D Given a polygon P and a point q in the plane of P, how would you ... – PowerPoint PPT presentation

Number of Views:82
Avg rating:3.0/5.0
Slides: 12
Provided by: george964
Category:
Tags: pmc | booleans | polygons

less

Transcript and Presenter's Notes

Title: PMC and Booleans


1
PMC and Booleans
  • Point-Membership Classification
  • Regularized Booleans between polygons

2
Point-in-polygon test in 2D
  • Given a polygon P and a point q in the plane of
    P, how would you test whether q lies inside P?
  • This is called Point-Membership Classification
    (abbreviated PMC)

3
Triangle-based point-in-polygon test
  • Algorithm for testing whether point Q is inside
    polygon P

Boolean PinPoly(Q,P) pt O origin or some
arbitrary point Boolean in false for (each
edge (A,B) of P) if (PinT(O,A,B,Q)) in !
in return in
boolean PinT(A,B,C,P) return (right(A,B,P)
right(B,C,P)) (right(A,B,P) right(C,A,P))
Why does it work?
4
XOR shading of a polygon in 2D
  • A?B is the set of points that lie in A or in B,
    but not in both
  • A?B p p?A ? p?B
  • Let A, B, C N be primitives, then A?B?C? ?N is
    the set of points contained in an odd number of
    these primitives
  • A?B p (p?A) XOR (p?B) XOR (p?C) XOR XOR
    (p?N)
  • How to shade a polygon A in 2D
  • Polygon P has edges Ei. Triangle Ti convex hull
    of OEi.
  • P T1?T2?T3? ?Tn
  • To fill P fill each Ti
  • while toggling status of visited pixel

Assume no pixel lies on boundary of any triangle
5
Example of XOR polygon filling
6
Relation to ray-casting approach?
  • A point Q lies in a set P if a ray from Q
    intersects the boundary of P an odd number of
    times
  • If ray hits a vertex or edge or is tangent to a
    surface, pick another ray
  • We do the same thing. Look at an example in 2D.
    Here
  • Only edges E1, E2, E3 intersect ray from Q to O
  • Thus only triangles T1, T2, T3 contain Q

Q
Ray from Q
O
Q is in because it is contained in an odd number
of triangles
7
Computing polygon area
  • Two methods
  • Sum of signed areas of triangles, each joining an
    arbitrary origin o to a different edge(a,b)
  • SUM oa?R(ob) for each edge (a,b)
  • Sum of signed areas between each oriented edge
    the x-axis

y
by
b
a
ay
x
ax
bx
area(a,b)(ayby)(bxax)/2
8
Area of the symmetric difference
  • The symmetric difference A?B measures the
    discrepancy between the two solids A and B
  • It is 0 when AB
  • Assume that A and B are bounded by consistently
    oriented polygonal loops.
  • Can I compute A?B by summing areas of triangles?

9
Boolean operation on polygons
  • Diminishing boundary principle The Boundary of a
    Boolean combination of shapes is a subset of the
    union of their boundaries
  • Strategy Generate-Split-Select
  • Generate a sufficient set of candidates edges of
    polygons
  • Split them at their pairwise intersections
  • Select the edge-segments on the boundary of the
    result
  • How to identify a good edge segment?
  • Must separate in from out

t
s
10
Boolean
  • AB (also written A \ B)

A
A
B
B
11
Regularization
  • AB ?

B
A
Write a Comment
User Comments (0)
About PowerShow.com