UMass Lowell Computer Science 91.504 Advanced Algorithms
Computational Geometry Prof. Karen Daniels
Spring, 2010
UMass Lowell Computer Science 91.504 Advanced Algorithms
Computational Geometry Prof. Karen Daniels
Spring, 2010
O’Rourke Chapter 6O’Rourke Chapter 6with some material from de Berg et al. Chapter 8with some material from de Berg et al. Chapter 8
ArrangementsArrangements
Chapter 6 Arrangements
Chapter 6 Arrangements
IntroductionIntroductionCombinatorics of ArrangementsCombinatorics of Arrangements
Incremental AlgorithmIncremental AlgorithmThree and Higher DimensionsThree and Higher Dimensions
DualityDualityHigher-Order Voronoi DiagramsHigher-Order Voronoi Diagrams
ApplicationsApplications
What is an Arrangement?What is an Arrangement?
(2D) ARRANGEMENT(2D) ARRANGEMENT: planar partition induced : planar partition induced by a collection of lines “arranged” in the plane.by a collection of lines “arranged” in the plane.
vertexvertex
edgeedge
faceface
Combinatorics of ArrangementsCombinatorics of Arrangements
• ““SimpleSimple” arrangement: ” arrangement: • Not “degenerate”Not “degenerate”• Every pair of lines meets in exactly 1 pointEvery pair of lines meets in exactly 1 point
• no parallel linesno parallel lines• No 3 lines meet in a pointNo 3 lines meet in a point• Forms Forms worst-caseworst-case for these combinatorial quantities for these combinatorial quantities
• For every For every simplesimple arrangement of arrangement of nn lines: lines:
2
nV
2nE
12
n
nF
)( 2n
de Berg or O’Rourke derivation de Berg or O’Rourke derivation (see next slides)(see next slides)
Each Each pairpair of lines of lines intersects once.intersects once.
Establish inductively.Establish inductively.
12
n
nF
Combinatorics of ArrangementsCombinatorics of Arrangements
de Berg derivation de Berg derivation ((upper boundupper bound))
• Add lines one by one, bounding the increase in number of faces Add lines one by one, bounding the increase in number of faces at each step.at each step.• Let and for define .Let and for define .• Denote the arrangement induced by Denote the arrangement induced by LL as as AA((LL). ).
• When adding When adding llii, every edge of , every edge of llii splits a face of the arrangement into 2. splits a face of the arrangement into 2.
• Number of faces increases by number of edges of Number of faces increases by number of edges of AA((LLi-i-11) on ) on llii..
• Upper bounded by Upper bounded by ii
• Total number of faces is therefore at most: Total number of faces is therefore at most:
},,{ 1 nllL ni 1 },,{ 1 ii llL
12/2/1 2
1
nnin
i
(for a (for a simplesimple arrangement) arrangement)
12
n
nF
Combinatorics of ArrangementsCombinatorics of Arrangements
• Reexamine proof of Euler’s formula (Reexamine proof of Euler’s formula (VV – – EE + + FF = 2) = 2)• Puncture polytope at a vertex Puncture polytope at a vertex vv (instead of interior of a face) and flatten to (instead of interior of a face) and flatten to
the planethe plane• Effects: Effects:
• lose 1 vertex, so (lose 1 vertex, so (VV – – EE + + FF = 1) = 1)• flattening stretches all edges incident to v to extend to infinityflattening stretches all edges incident to v to extend to infinity
• How to flatten? Stereographic projectionHow to flatten? Stereographic projection• result is topologically equivalent to an arrangementresult is topologically equivalent to an arrangement• so so VV – – EE + + FF = 1 holds for an arrangement = 1 holds for an arrangement
• Now substitute for known values of Now substitute for known values of VV and and EE
O’Rourke O’Rourke derivation derivation
(more complex) (more complex)
(for a (for a simplesimple arrangement) arrangement)
vv
pp
p’p’
Combinatorics of ArrangementsZone Theorem
Combinatorics of ArrangementsZone Theorem
The total number of edges in all the cells that intersect The total number of edges in all the cells that intersect one line in an arrangement of n lines is zone line in an arrangement of n lines is znn ≤ 6n. ≤ 6n.
O(n)O(n)
LL
ArrangementArrangement AA
Zone Z(L)= Zone Z(L)= set set of cells of cells intersected by L.intersected by L.
zznn= = maximum of maximum of
|Z(L)| over all L |Z(L)| over all L
CellCell AA
AA
BB
BB
CC
CC
DD
DD
Combinatorics of ArrangementsZone Theorem
Combinatorics of ArrangementsZone Theorem
LL
ArrangementArrangement A A (rotated)(rotated)
Assume: no line parallel to L, L horizontal, (Assume: no line parallel to L, L horizontal, (no vertical lines?no vertical lines?))
Partition edges of each cell of Z(L) into left-bounding and Partition edges of each cell of Z(L) into left-bounding and right-bounding edges:right-bounding edges:
- left-bounding edge has interior points of cell immediately to - left-bounding edge has interior points of cell immediately to its right. Analogous definition for right-bounding edge.its right. Analogous definition for right-bounding edge.
Left-bounding edge
Right-bounding edge
Combinatorics of ArrangementsZone Theorem
Combinatorics of ArrangementsZone Theorem
LL
ArrangementArrangement A A (rotated)(rotated)
Inductive Proof SketchInductive Proof Sketch: Induct on number of lines n: Induct on number of lines n
-Base Case: Empty arrangement has no left edges.Base Case: Empty arrangement has no left edges.
-Inductive Hypothesis: Inductive Hypothesis: IIn-1 n-1 ≤3(n-1)≤3(n-1)
-Inductive Step: Remove a line r from A to form A’, then put it back. Line whose Inductive Step: Remove a line r from A to form A’, then put it back. Line whose intersection with L is rightmost is r. Inductive hypothesis gives Iintersection with L is rightmost is r. Inductive hypothesis gives In-1 n-1 ≤3(n-1). ≤3(n-1).
Show putting r back adds at most 3 left edges so that IShow putting r back adds at most 3 left edges so that In n ≤3n-3+3 = 3n. ≤3n-3+3 = 3n.
Reason: r adds one new left edge and splits at most 2 old left edges.Reason: r adds one new left edge and splits at most 2 old left edges.
-- see next slide- see next slide
Proof GoalProof Goal: : Show number Show number of left edges of left edges IInn
in zin znn is ≤ 3n. is ≤ 3n.
(Right case is (Right case is symmetric.)symmetric.)
rr
Combinatorics of ArrangementsZone Theorem
Combinatorics of ArrangementsZone Theorem
LL
ArrangementArrangement A’ A’ (rotated)(rotated)
Inductive Proof Sketch (continued)Inductive Proof Sketch (continued): :
Inductive StepInductive Step: Show putting r back adds at most 3 left edges so that I: Show putting r back adds at most 3 left edges so that In n ≤3n-3+3 = 3n. ≤3n-3+3 = 3n.
Reason: r adds one new left edge and splits at most 2 old left edges.Reason: r adds one new left edge and splits at most 2 old left edges.
-- r just adds one new left edge to C since r is rightmost- r just adds one new left edge to C since r is rightmost
-- proof by contradiction shows no other new left zone edges are created; r - proof by contradiction shows no other new left zone edges are created; r slopes slopes upwards upwards and has rightmost intersectionand has rightmost intersection
- r splits at most 2 old left zone edges in r splits at most 2 old left zone edges in convexconvex rightmost cell of A’ rightmost cell of A’
AA
AA
BB
BB
CC
CC rr
Incremental AlgorithmIncremental Algorithm
AlgorithmAlgorithm: ARRANGEMENT CONSTRUCTION: ARRANGEMENT CONSTRUCTION
Construct AConstruct A00, a data structure for an empty arrangement, a data structure for an empty arrangement
for each i = 1,...,n dofor each i = 1,...,n do
Insert line LInsert line Lii into A into Ai-1 i-1 as follows: as follows:
Find an intersection point Find an intersection point xx between L between Lii and some line of A and some line of Ai-1 i-1
Walk forward from Walk forward from xx along cells in Z(L along cells in Z(Lii))
Walk backard from Walk backard from xx along cells in Z(L along cells in Z(Lii))
Update AUpdate Ai-1 i-1 to Ato Aii
(n(n22) time and space) time and space
LLii
Inserting Line LInserting Line Lii
x
Structure of Structure of arrangement arrangement is leveraged is leveraged
to avoid to avoid sorting.sorting.
Three and Higher DimensionsThree and Higher Dimensions
• 2D results extend to higher dimensions2D results extend to higher dimensions• For an arrangement of hyperplanes in d For an arrangement of hyperplanes in d
dimensionsdimensions• number of faces is O(nnumber of faces is O(ndd))• zone of a hyperplane has complexity O(nzone of a hyperplane has complexity O(nd-1d-1))• construct in O(nconstruct in O(ndd) time and space) time and space
DualityDuality
• Key to many arrangement applicationsKey to many arrangement applications• 1-1 mapping of (parameters of) collections of geometric entities1-1 mapping of (parameters of) collections of geometric entities• Desirable mappings preserve characteristics: incidence and/or orderDesirable mappings preserve characteristics: incidence and/or order
),(:::1 bmpbmxyL
xx
yy
primal spaceprimal space
dual spacesdual spaces
pp55
pp44 pp33
pp22
pp11
),(:::2 bmpbmxyL
xx
yy
11((pp33))
11((pp22))
11((pp11))
11((pp44))
11((pp55))
xx
yy
22((pp33))
22((pp22))
22((pp11))
22((pp44))
22((pp55))
(already seen in de Berg et al.)(already seen in de Berg et al.)
Duality via Parabolic TangentsDuality via Parabolic Tangents
• Convenient in Computational GeometryConvenient in Computational Geometry• y = 2ax - ay = 2ax - a22 is tangent to parabola y=x is tangent to parabola y=x22 at point (a,a at point (a,a22))
),(:2:: bapbaxyLD
xx
yy
primal spaceprimal space
pp55
pp44 pp33
pp22
pp11
xx
yy
DD((pp33))
DD((pp22))
DD((pp11))
DD((pp44))
DD((pp55))
dual space dual space
Properties of DProperties of D::
- is its own inverse- is its own inverse
- preserves point-line - preserves point-line incidenceincidence
- 2 points determine a line <-- 2 points determine a line <-> 2 lines determine an > 2 lines determine an intersection pointintersection point
- preserves above/below - preserves above/below orderingordering
(already seen in (already seen in previous chapter)previous chapter)
• Intersection of two adjacent tangents Intersection of two adjacent tangents projects to 1D Voronoi diagram of the two projects to 1D Voronoi diagram of the two 1D points:1D points:• 2 tangents above x = a, x=b2 tangents above x = a, x=b
• 2ax-a2ax-a22 = 2bx-b = 2bx-b22
• 2x(a-b)=a2x(a-b)=a22-b-b22=(a-b)(a+b)=(a-b)(a+b)• x= (a+b)/2x= (a+b)/2
Duality via Parabolic TangentsDuality via Parabolic Tangents
Higher-Order Voronoi DiagramsHigher-Order Voronoi Diagrams
• Relationship between Voronoi diagrams and arrangementsRelationship between Voronoi diagrams and arrangements• Order in which tangents are encountered moving down vertical x=b is Order in which tangents are encountered moving down vertical x=b is
same as order of closeness of b to the xsame as order of closeness of b to the xii’s that generate the tangents’s that generate the tangents• k-level of arrangement = set of edges whose points have exactly k-level of arrangement = set of edges whose points have exactly
k-1 lines strictly above them, together with edge endpointsk-1 lines strictly above them, together with edge endpoints• Points of intersection of k- and (k+1)-levels in parabola arrangement Points of intersection of k- and (k+1)-levels in parabola arrangement
project to kth-order Voronoi diagramproject to kth-order Voronoi diagram
1-D diagram1-D diagram
Points on Points on x-axis x-axis map to map to tangents tangents to to parabola parabola y=xy=x22
xxpp55
pp44pp33pp22pp11
DD((pp11))
DD((pp22))
DD((pp33))
DD((pp44))
DD((pp55))projects to projects to 22ndnd order order diagramdiagram
xx
3-level3-level
2-level2-level
projects to projects to 11stst order order diagramdiagram
ApplicationsApplications
• K-Nearest NeighborsK-Nearest Neighbors• kth order Voronoi diagram can be used to find k-nearest neighbors of query pointkth order Voronoi diagram can be used to find k-nearest neighbors of query point
• Hidden Surface Removal for GraphicsHidden Surface Removal for Graphics• topological sweep of arrangement of objectstopological sweep of arrangement of objects
• Aspect Graphs for Computer VisionAspect Graphs for Computer Vision• characteristic views an object can present to viewer (combinatorially equivalent)characteristic views an object can present to viewer (combinatorially equivalent)
• Smallest Polytope ShadowSmallest Polytope Shadow• combinatorial structure of shadow projection changes when viewpoint crosses a combinatorial structure of shadow projection changes when viewpoint crosses a
planeplane
• Ham-Sandwich Cuts of a Point Set Ham-Sandwich Cuts of a Point Set • bisector of point set is line having at most ½ points strictly to each sidebisector of point set is line having at most ½ points strictly to each side• bisectors of point set dualize to median level of dual line arrangement bisectors of point set dualize to median level of dual line arrangement • all ham-sandwich cuts for sets A, B: intersect median levels of A, Ball ham-sandwich cuts for sets A, B: intersect median levels of A, B• higher dimensional generalization: for d point sets in d dimensions, there exists a higher dimensional generalization: for d point sets in d dimensions, there exists a
hyperplane simultaneously bisecting each point sethyperplane simultaneously bisecting each point set
de Berg et al. Chapter 8de Berg et al. Chapter 8
• Motivating application:Motivating application:• Compute Compute discrepancydiscrepancy to support “supersampling” to support “supersampling”
(many rays per pixel) in graphics ray tracing(many rays per pixel) in graphics ray tracing• use random rays to avoid artifactsuse random rays to avoid artifacts
• DiscrepancyDiscrepancy: of sample set with respect to an object: of sample set with respect to an object• measures quality of set of measures quality of set of nn random rays random rays • = difference between % hits for an object and % of pixel = difference between % hits for an object and % of pixel
area where object is visible (goal is to make difference area where object is visible (goal is to make difference smallsmall))
• Object behaves like half-plane inside pixel, so define half-Object behaves like half-plane inside pixel, so define half-plane discrepancy = maximum of discrepancies over all plane discrepancy = maximum of discrepancies over all possible half-planespossible half-planes
• Compute this in O(Compute this in O(nn22) time by using (for one case) a point-) time by using (for one case) a point-to-line duality to create an arrangement, then evaluating to-line duality to create an arrangement, then evaluating levels in the arrangement.levels in the arrangement.
• Number of lines above, through, and below each vertex of Number of lines above, through, and below each vertex of arrangement provide means to compute half-plane arrangement provide means to compute half-plane discrepancydiscrepancy..