Upload
dinhkhanh
View
219
Download
2
Embed Size (px)
Citation preview
1
Computational GeometryProf.Dr.Th.Ottmann
1Lection 1:Introduction
Professor Dr.Thomas OttmannAlbert Ludwigs University
Freiburg
Computational GeometryComputational Geometry
Computational GeometryProf.Dr.Th.Ottmann
2Lection 1:Introduction
• History: Proof-based, agorithmic, axiomatic geometry, computational geometry today
• Problems and applications• An example: Computing the convex hull:
1. the “naive approach”2. Graham‘s Scan3. Lower bound
• Design, analysis, and implementation of geometrical algorithms
Lecture 1: Introduction
Computational GeometryProf.Dr.Th.Ottmann
3Lection 1:Introduction
Ancient example of proof-based geometry
Pythagoras´s Theorem (562 - 475 BC):
The sum of the squares of the sides of a right triangleis equal to the square of the hypotenuse.
Already known to the Babylonians and Egyptians asexperimental fact.Pythagorean innovation: A proof, independent of experimental numerical verification.
Computational GeometryProf.Dr.Th.Ottmann
4Lection 1:Introduction
PythagorasBorn: about 562 BC in Samos
Died: about 475 BC
Computational GeometryProf.Dr.Th.Ottmann
5Lection 1:Introduction
Pythagoras´s theorem
Computational GeometryProf.Dr.Th.Ottmann
6Lection 1:Introduction
Proof of Pythagoras´s Theorem
2
Computational GeometryProf.Dr.Th.Ottmann
7Lection 1:Introduction
Rhind papyrus (approx. 1650 BC), copy of an older papyrus of (approx. 1900 BC)
Problem 50: A circular field has diameter 9 khet. What is its area?
Solution: Subtract 1/9 of the diameter which leaves 8 khet. The area is 8 multiplied by 8 or 64 setat.
Ancient example of a geometrical algorithm
Computational GeometryProf.Dr.Th.Ottmann
8Lection 1:Introduction
The Rhind Papyrus
Computational GeometryProf.Dr.Th.Ottmann
9Lection 1:Introduction
- approaches π up to 2%
- "experimental quadrature of the circle "
89
A = ((8/9)2r)²
= 256/81 r²
= ca 3.16 r²
Computational GeometryProf.Dr.Th.Ottmann
10Lection 1:Introduction
Ancient example of Axiomatic Geometry
Born: about 325 BC
Died: about 265 BC in Alexandria, Egypt
Some axioms from the "The Elements" of Euclid
Computational GeometryProf.Dr.Th.Ottmann
11Lection 1:Introduction
Fundamental notions: Point, straight line, plane,incidence relation (" lies on ", " goes through ")
A1: For any two points P and Q there is exactly one straight line g on which P and Q lie.
A2: For each straight line g there is one point, which is not on g.
A3: For each straight line to g and each point P, whichis not on g, there is exactly one straight line h, on which P lies and which does not have a common point with g.
Ancient example of Axiomatic Geometry
Computational GeometryProf.Dr.Th.Ottmann
12Lection 1:Introduction
Question: Is A3 independent of A1 and A2?
Klein´s model
ph
h
g
Klein´s model
3
Computational GeometryProf.Dr.Th.Ottmann
13Lection 1:Introduction
Independence of the parallel axiom
Computational GeometryProf.Dr.Th.Ottmann
14Lection 1:Introduction
Computational Geometry today
• Back to the historical roots• Search for simple, robust, efficient algorithms • Fragmentation into:
Rather theoretical investigations Development of practically useful tools
• Hundreds of papers per year • Application of algorithmic techniques and data
structures • Efficient solution of fundamental, " simple" problems • Development of new techniques and data structures
- Randomization and incremental construction - Competitive algorithms
1
Computational GeometryProf.Dr.Th.Ottmann
1Lection 1:Introduction
• History: Proof-based, algorithmic, axiomatic geometry, computational geometry today
• Problem fields• An example: Computing the convex hull:
1. the “naive approach”2. Graham‘s Scan3. Lower bound
• Design, analysis, and implementation of geometrical algorithms
Lecture 1: Introduction
Computational GeometryProf.Dr.Th.Ottmann
2Lection 1:Introduction
Problem fields
• Typical questions
• Geometrical objects: points, lines, surfaces
• Techniques
• Applications
Computational GeometryProf.Dr.Th.Ottmann
3Lection 1:Introduction
Finding the nearest fast-food restaurant
Computational GeometryProf.Dr.Th.Ottmann
4Lection 1:Introduction
Partitioning the plane into areas of equal nearest neighbors
Computational GeometryProf.Dr.Th.Ottmann
5Lection 1:Introduction
Art gallery problem
How many stationary guards are needed to guard the room?
Computational GeometryProf.Dr.Th.Ottmann
6Lection 1:Introduction
Watchmen routes
Compute the optimal watchmanroute for a mobile guard
2
Computational GeometryProf.Dr.Th.Ottmann
7Lection 1:Introduction
Visibility problems
Hidden-line-elimination
Visible surface computation
Computational GeometryProf.Dr.Th.Ottmann
8Lection 1:Introduction
Intersection problems
Given a set of line segments,rectangles, polygons, ...:Compute all pairs of intersectingObjects.
Computational GeometryProf.Dr.Th.Ottmann
9Lection 1:Introduction
Geometric objects: Points, lines, …
Computational GeometryProf.Dr.Th.Ottmann
10Lection 1:Introduction
Different algorithms for points
Minimum spanning tree
•
••
••
•
•
•
Computational GeometryProf.Dr.Th.Ottmann
11Lection 1:Introduction
Different algorithms for points
Delauney triangulation
••
•
••
•
•
•
Computational GeometryProf.Dr.Th.Ottmann
12Lection 1:Introduction
Different algorithms for points
Convex hull
•
•
•
•
•
•
••
3
Computational GeometryProf.Dr.Th.Ottmann
13Lection 1:Introduction
Voronoi Region
Computational GeometryProf.Dr.Th.Ottmann
14Lection 1:Introduction
Voronoi Diagram
Computational GeometryProf.Dr.Th.Ottmann
15Lection 1:Introduction
Geometric search
Closest pair
Is it possible to close the gap between Ω(n log n) and O(n²)?
Asymptotic bounds are relevant!
Computational GeometryProf.Dr.Th.Ottmann
16Lection 1:Introduction
Difference between n, n log n and n²n n log n n²
210 ≅10³ 10 • 210 ≅ 104 220 ≅ 106
220 ≅ 106 20 • 220 ≅ 2 • 107 240 ≅1012
InteractiveProcessing n log n algorithms n² algorithmsn = 1000 yes ?
n = 1000000 ? no
Computational geometry has developed new types of algorithms which may solve basic geometric problemsefficiently.
Computational GeometryProf.Dr.Th.Ottmann
17Lection 1:Introduction
Application domainsComputer graphics: 2- and 3-dimensional
Robotics, CAD, CAM
VLSI design
Database systems, GIS
Molecular modelling, ....
Computational GeometryProf.Dr.Th.Ottmann
18Lection 1:Introduction
Geographical information systems
UNI-Offspringsofion
Documentation, analysis, and maintenance of gas, water andsewage pipesand telecommunications lines
4
Computational GeometryProf.Dr.Th.Ottmann
19Lection 1:Introduction
Robotics
Laserscan robot
Localisation and path-finding inunknown environments. Example of an On-line scenario of geometrical algorithms
1
Computational GeometryProf.Dr.Th.Ottmann
1Lection 1:Introduction
• History: Proof-based, algorithmic, axiomatic geometry, computational geometry today
• Problem fields• An example: Computing the convex hull:
1. the “naive approach”2. Graham‘s Scan3. Lower bound
• Design, analysis, and implementation of geometrical algorithms
Lecture 1: Introduction
Computational GeometryProf.Dr.Th.Ottmann
2Lection 1:Introduction
Convex Hulls
Subset of S of the plane is convex, if for all pairs p,qin S the line segment pq is completely contained in S.
The Convex Hull CH(S) is the smallest convex set, which contains S.
p
q
pq
p
q
pq
Computational GeometryProf.Dr.Th.Ottmann
3Lection 1:Introduction
Convex hull of a set of points in theplane
•
••
•
••
•
•
•
Rubber band experiment
The convex hull of a set P of points is the unique convex polygon whose vertices are points of P and which containsall points from P.
Computational GeometryProf.Dr.Th.Ottmann
4Lection 1:Introduction
Polygons
A polygon P is a closed, connected sequence of line segments.
A polygon is simple, if it does not intersect itself.
A simple polygon is convex,if the enclosed area is convex.
Computational GeometryProf.Dr.Th.Ottmann
5Lection 1:Introduction
Computing the convex hull
•
•
p q•
•
• ••
••
•
Right rule: The line segmentpq is part of the CH(P) iffall points of P-p,q lie to the right of the line through p and q
Computational GeometryProf.Dr.Th.Ottmann
6Lection 1:Introduction
Naive procedureInput : A set P of points in the plane
Output : Convex Hull CH(P)
1. E=∅2. for all (p, q) from PxP with p ≠ q3. valid = true4. for all r in P with r ≠ p and r ≠ q 5. if r lies to the left of the directed line from p to q6. valid = false 7. if valid then for E = E ∪ pq
Construct CH(P) as a list of nodes from E Run time: O(n)³
2
Computational GeometryProf.Dr.Th.Ottmann
7Lection 1:Introduction
Degenerate cases
•
•
••••••••
••
• •
• 1. Linear dependency: more points are on a line .
Solution: extended definition by cases
2. Rounding errors dueto computer arithmetic (floats).
Solution: symbolic computation,interval arithmetic
• ••
Computational GeometryProf.Dr.Th.Ottmann
8Lection 1:Introduction
An incremental algorithm
Upper Hull
••
••
• •
•
•
• •
•
•
••
•
• •
•
•X
X
s
z
Lower Hull
Partitioning of the problem:
Incremental approach:
Given: Upper hull forp1,...,pi-1
Compute: Upper hull for p1,...,pi
X
Computational GeometryProf.Dr.Th.Ottmann
9Lection 1:Introduction
Computation of UH (Graham Scan)
••
•
•
•• •
••
•
• •• •
••
• •
•
Computational GeometryProf.Dr.Th.Ottmann
10Lection 1:Introduction
Fast computation of the convex hullInput/output: see " naive procedure "
Sort P according to x-CoordinatesLU= p1, p2
for i = 3 to nLU = LU ∪ pi while LU contains more than 2 points and the
last 3 points in LU do not make a right turndo delete the middle of last 3 points
LL= pn, pn-1 for i = n-2 to 1
LL = LL ∪ pi while LL contains more than 2 points and the
last 3 points in LL do not make a right turndo delete the middle of last 3 points
delete first and last point in LL CH(P) = LU ∪ LL
Computational GeometryProf.Dr.Th.Ottmann
11Lection 1:Introduction
RuntimeTheorem: The fast algorithm for computing the convex hull(Graham Scan) can be carried out in time O(n log n).
Proof: (for UH only)Sorting n points in lexicographic order takes time O(n log n).Execution of the for-loop takes time O(n).Total number of deletions carried out in all executionsof the while loop takes time O(n).
Total runtime for computing UH is O(n log n)
Computational GeometryProf.Dr.Th.Ottmann
12Lection 1:Introduction
CorrectnessProof: for Upper Hull by induction:
(1) p1, p2 is a correct UH for a set of 2 points.
(2) Assume: p1,...,pi is a correct UH for i points and consider pi+1
By induction a too high point may lie only in the slab V. This, however, contradicts the lexicographical order of points!
••
••
•
•• • •• •
•
pi
V
••pi+1
3
Computational GeometryProf.Dr.Th.Ottmann
13Lection 1:Introduction
Lower boundReduction of the sorting problem to the computation of the convex hull.
1. x1, ... ,xn → (x1, x1²), ... ,(xn,, xn²) O(n)
2. Costruct the convex hull for these points
3. Output the points in (counter-)clockwise order
x1 x2 ... xn
Computational GeometryProf.Dr.Th.Ottmann
14Lection 1:Introduction
Design, Analysis & Implementation
1. Design the algorithm and ignore all special cases.2. Handle all special cases and degeneracies.3. Implementation:
Computing geometrical objects: best possibleDecisions (e.g. comparison operations): suppose exact (correct) results
Support:Libraries: LEDA, CGALVisualizations: VEGA
1
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
1
Line Segment Intersection
• Motivation: Computing the overlay of several maps
• The Sweep-Line-Paradigm: A visibility problem
• Line Segment Intersection
• The Doubly Connected Edge List
• Computing boolean operations on polygons
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
2
Maps
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
3
MotivationThematic map overlay in Geographical Information Systems
road river overlaid maps
1. Thematic overlays provide important information.
2. Roads and rivers can both be regarded as networks of line segments.
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
4
Problem definitionInput: Set S = s1...,sn of n closed line segments si=(xi, yi), (x´i, y´i)
•• • ••••
•• •
Output: All intersection points among the segments in S
The intersection of two lines can be computed in time O(1).
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
5
Naive algorithm
Goal: Output sensitive algorithm!
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
6
The Sweep-Line-Paradigm: A visibility problem
Input: Set of n vertcal line segmentsOutput: All pairs of mutually visible segments
AB
C
D
E
FG
H
Naive method:
Observation: Two line segments s and s´are mutually visible iffthere is a y such that s and s´are immediateneighbors at y.
2
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
7
Sweep line algorithmQ is set of the start and end points of the segments in decreasing y-order
T is set of the active line segments
AB
C
D
E
F
G
H
Q T.H H.D D!H.A A!DH.F A!D!F!H.C A!C!DFH.E ACD!E!FHD. AC!EFH.G ACEF!G!H.B A!B!CEFGHF. ABCE!GHC. AB!EGH:: : : :
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
8
while Q ≠ ∅ dop = Q.Min; remove p from Q;if (p start point of segment s)
T = T ∪ s; determine neighbors s´and s´´ of s;report (s, s´) and (s,s´´) as visible pairs
else /* p is end point of segment s */determine neighbors s´and s´´ of s;report (s´, s´´) as visible pair;T = T - s
Initialise Q as set of start and endpoints of segments in decreasing y-order;Initialise the set of active segments T = ∅;
Algorithm
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
9
Sweep Line principle
Imaginary line moves in y direction.Each point is an event.
Input: A set of (iso-oriented objects)Output: Problem-dependent
Q: object and problem-dependant queue of event pointsT: ordered set of the active objects /* status structure */
while Q ≠ ∅ doselect next event point from Q and remove it from Q;update(T);report problem-dependent result
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
10
Data structures: event queue
Operations to be supported:
Initialisation, min, deletion of points,
Possible implementation: Balanced search tree of points with order
p < q ⇔ py < qy or (py = qy and px < qx)
Initialisation takes time O(m log m) for m items.Deletion takes time O(log m) with m items in queue.
In most cases a priority queue supporting insertion and min-removal(eg. heap, O(m), O(log m), for initialisation and min-removal) is enough .
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
11
Data structures: status structure
mlij
k
Possible implementation:
Balanced search tree, O(log n) time
Node values (keys) are used for routing
k
m
i
ij
l
l
j k
Operations to be supported:Insertion, deletion, searching for neighbors
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
12
Runtime analysis
while Q ≠ ∅ dop = Q.Min; remove p from Q;if (p start point of segment s)
T = T ∪ s; determine neighbors s´and s´´ of s;report (s, s´) and (s,s´´) as visible pairs
else /* p is end point of segment s */determine neighbors s´and s´´ of s;report (s´, s´´) as visible pair;T = T - s
Initialise Q as set of start and endpoints of segments in decreasing y-order;
Initialise the set of active segments T = ∅;
3
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
13
SummaryTheorem: For a given set of n vertical line segments all k pairs of mutually visible segments can be reported in time O(n log n).
Note: k is O(n)
1
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
1
Line Segment Intersection
• Motivation: Computing the overlay of several maps
• The Sweep-Line-Paradigm: A visibility problem
• Line Segment Intersection
• The Doubly Connected Edge List
• Computing boolean operations on polygons
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
2
Line segment intersection Input: Set S = s1...,sn of n closed line segments si=(xi, yi), (x´i, y´i)
•• • ••••
•• •
Output: All intersection points among the segments in S
The intersection of two lines can be computed in time O(1).
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
3
Sweep line principle
•• •
Event queue: upper, lower, intersection pointsStatus structure: Ordered set of active line segments
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
4
Example: Segment Intersection
A
DC
B
E
A
CD
CE
BAD
Q T
E
B
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
5
Data structures: Event Queue Q
Operations: Initialisation (sequence of upper and lower endpointsof segments in decreasing y-order), min-delete, insertion (of intersection points)
Implementation: Balanced search tree with order
p < q⇔ py < qy or (py = qy and px < qx)
Space: O(n + k), k = #intersections
Time: Initialisation: O(n log n)
Min-delete: O(log n)
Insertion: O(log n)
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
6
Data structures: Status structure T
Balanced search tree
k
m
i
ij
l
l
j k
i jk
l m
Operations: insertion, deletion, neighbor search,(changing order)
Space: O(n)Time: O(log n)
2
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
7
Number of operations, total time
n = #segments
k = #intersections
Number of operations on event queueQ: <= 2n+k,
Number of operations on status structureT: <= 2n+k
Result: Total time required to carry out the sweep-line algorithm for computing all k intersections in a set of n line segments is O((n+k) log n).
The sweep-line algorithm is output sensitive!
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
8
A simple neighborhood lemma
Lemma : Let si and sj be two non-horizontal segments intersecting in a single point p and no third segment passing through p. Then there isan event point above p where si and sj become adjacent and are tested for intersection.
Lp
si sj
Proof : L is so close to p that si and sj are next toeach other. Since si and sj are not yet adjacent at the beginning of the algorithmthere is an event q where si and sj becomeadjacent and tested for intersection.
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
9
Handling special cases
3
8
4
5
7
1
3
2
1
•P L
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
10
Special cases I1
35
7 4
47 5 1
3 8
L(P)
C(P)
3
8
4
5
7
1
3
2
1
•P L
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
11
Special cases II2
13
7
7 3
12 8
U(P)
C(P)
C(P)
3
8
4
5
7
1
3
2
1
•P L
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
12
HandleEventPoint(p)
if ( L(p) ∪ U(p) ∪ C(p) contains more than 1 segment)then report p as intersection;
delete L(p) ∪ C(p) from T;insert U(p) ∪ C(p) into T;
if ( U(p) ∪ C(p) = ) then Let sl and sr be left and right neighbours of p in T
FindNewEvent(sl,sr,p)else
s´ = leftmost segment of U(p) ∪ C(p) in Tsl = left neighbour of s´ in T FindNewEvent(sl,s´,p)s´´ = rightmost segment of U(p) ∪ C(p) sr = right neighbour of s´´ in T FindNewEvent(s´´,sr,p)
3
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
13
FindNewEvent(s,s´,p)
If (s and s´ intersect below the sweep line Lor on it and to the right of the current event point p)and (the intersection of s and s´is not yet present in Q)then insert the intersection point into Q;
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
14
Summary
Theorem: Let S be a set of n line segments in the plane. All intersectionpoints in S, with for each intersection point the segments involved in it,can be reported in O(n log n + k log n) time and O(n) space, where kis the size of the output..
k can be reduced to I, I = #intersections
1
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
1
Line Segment Intersection
• Motivation: Computing the overlay of several maps
• The Sweep-Line-Paradigm: A visibility problem
• Line Segment Intersection
• The Doubly Connected Edge List
• Computing boolean operations on polygons
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
2
Maps
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
3
MotivationThematic map overlay in Geographical Information Systems
road river Overlaid maps
1. Thematic overlays provide important information.
2. Roads and rivers can both be regarded as networks of line segments.
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
4
Doubly Connected Edge List
1
1
23
4
5
6
7
2 3
4
5
6
7
8••
•
•• ••
Examplenode 1 = ((1, 2)), 12 face 1 = 15, [ 67 ] edge 54 = 5, 45, 1, 43, 15
3 Records : vertex CoordinatesIncidentEdge
;face
OuterComponentInnerComponent
;halfedge
OriginTwinIncidentFaceNextPrev
;
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
5
Overlay
Plane Sweep (downward above) Data structures : Status structure T, Event Queue Q,
Doubly Connected Edge List DEdges in Q and D are crosswise connected
•
• •
•
•
•
•
•
••
•
••
••
•
• •
•
•
•
•
•
••
•
••
••
•S2
S1
U(S1,S2)
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
6
Overlay
2
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
7
Re-use received from edges, there orientationremains
Updating of T and Q such as segment intersection
2 phases: Edges and corners surfaces
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
8
Edges and CornersExample: Edge of a component cuts nodes of the other
Two halfedge Records e´, e´´ with v asorigin generate set twin-pointers and double edges NEXT and PREV at the corner points set and neighbours of e update
⇒ time O(1 + deg(v)) at a node
⇒ time O(n l og n + k l og n) altogether,
k complexity O(s1, s2)
e´
e´´
v
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
9
Surfaces
Difference inside and outside by 180°
f
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
10
Surfaces
c6c7
c3c5c1
c2
c4c8
Difference same surface
Applies only to linked nodes!
c1
c6
c3
c2c5
c8
c4
c7
Outside
Holes
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
11
Construction of G
c c´
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
12
Construction of G
c c´
Theorem : Connected components form a surface Gcan be designed in O(n+k).
3
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
13
Boolean Operations For Polygons
P1P2
P1 AND P2
P1 OR P2
P1 – P2
(new surfaces in overlap)
(all surfaces in overlap)
(old faces) - (newly generated faces)
Let n = |P1| + |P2|All 3 operations can be calculated in O(n log n + k log n),k is output size
Lecture 2Line Segment Intersection
Computational GeometryProf.Dr.Th.Ottmann
14
LEDALibrary of Efficient Datastructures and Algorithms
http://www.mpi-sb.mpg.de/ LEDA/leda.html
http://www.mpi-sb.mpg.de/ mehlhorn/LEDAbook.html
Installed under :
/usr/local/leda/v3.6.1
1
Computational GeometryProf. Dr. Th. Ottmann
1Lecture 3:Polygon Triangulation
Polygon Triangulation
• Motivation: Guarding art galleries
• Art gallery theorem for simple polygons
• Partitioning of polygons into monotone pieces
• Triangulation of y-monotone polygons
Computational GeometryProf. Dr. Th. Ottmann
2Lecture 3:Polygon Triangulation
Guarding art galleries
“Art Gallery“ Problem
Visibility polygon
Computational GeometryProf. Dr. Th. Ottmann
3Lecture 3:Polygon Triangulation
Guarding a triangulated polygon
Computational GeometryProf. Dr. Th. Ottmann
4Lecture 3:Polygon Triangulation
Triangulation of simple polygons
• • •
•••
• ••
•
• •••wv
u• • •
•••
• ••
•
• •••
Computational GeometryProf. Dr. Th. Ottmann
5Lecture 3:Polygon Triangulation
Theorem
Theorem: Every simple polygon admits a triangulation, and anytriangulation of a simple polygon with n vertices consistsof exactly n-2 triangles.
Proof: By induction on n. Let n>3, and assume theorem is truefor all m<n. Let P be polygon with n vertices. We first prove the existence of a diagonal in P. Let v be leftmostvertex of P. Let u and v be two neighboring vertices of v.If uw lies in the interior of P we have found a diagonal. Else, there are one or more vertices inside the triangle defined by u, v, and w, or the diagonal uw. Let v´ be the farthest vertex from uw. The segment connecting v´ to v cannot intersect an edge of p (contradicts the definition of v´). Hence vv´ is a diagonal.
Computational GeometryProf. Dr. Th. Ottmann
6Lecture 3:Polygon Triangulation
Continuation of proof
So a diagonal exists. Any diagonal cuts P in two simple sub-polygons P1 and P2. Let m1 be the number of vertices of P1and m2 the number of vertices of P2. Both m1 and m2 mustbe smaller than n, so by induction P1 and P2 can be triangulatedso P can be triangulated as well.
Now we have to prove any triangulation of P contains n-2 triangles. Consider an arbitrary diagonal in some triangulation Tp.This diagonal cuts P into 2 subpolygons with m1 and m2 vertices.Every vertex of P occurs in exactly one of 2 subpolygons. Hencem1+m2 = n+2. So by induction any triangulation of Pi containsmi-2 triangles ⇒ (m1-2) + (m2-2) = n-2 triangles.
2
Computational GeometryProf. Dr. Th. Ottmann
7Lecture 3:Polygon Triangulation
Number of triangles in any triangulation of a simple polygon with n vertices.
Case 1: n=3
Case 2: n>3
Computational GeometryProf. Dr. Th. Ottmann
8Lecture 3:Polygon Triangulation
Case 2: uw not completely in P
Proof of the existence of diagonals in P
Consider leftmost vertex v of P
Case 1: uw completely in P
uv
w
uv
w
Computational GeometryProf. Dr. Th. Ottmann
9Lecture 3:Polygon Triangulation
Proof of the existence of a diagonal in P
Computational GeometryProf. Dr. Th. Ottmann
10Lecture 3:Polygon Triangulation
Computational GeometryProf. Dr. Th. Ottmann
11Lecture 3:Polygon Triangulation
Upper and lower bounds for the number of guards
Idea: Compute a 3-coloring of the vertices and place guards on a color.Result: n/3 guards are sufficient.
••
•
•••
••
•• •
•
••
We know that for any simple polygon with n vertices (n-2)guards are always enough.
But can we do better?
Computational GeometryProf. Dr. Th. Ottmann
12Lecture 3:Polygon Triangulation
Example
3
Computational GeometryProf. Dr. Th. Ottmann
13Lecture 3:Polygon Triangulation
Theorem
Theorem: Each simple polygon is 3-colorable.
Proof: Dual graph is a binary tree, this means that we canfind a 3-coloring using a simple DFS.
Corollary: n/3 guards are always sufficient to guard a simplePolygon with n vertices.
Computational GeometryProf. Dr. Th. Ottmann
14Lecture 3:Polygon Triangulation
Art gallery theorem
Theorem: For a simple polygon with n vertices, n/3 cameras are occasionally necessary and always sufficient to have every point inthe polygon visible from at least one of the cameras.
Proof: Worst-case example.
1
Computational GeometryProf. Dr. Th. Ottmann
1Lecture 3:Polygon Triangulation
Triangulation (Naive)
Computational GeometryProf. Dr. Th. Ottmann
2Lecture 3:Polygon Triangulation
Triangulation (Naive)
Computational GeometryProf. Dr. Th. Ottmann
3Lecture 3:Polygon Triangulation
Triangulation of a convex polygon
Computational GeometryProf. Dr. Th. Ottmann
4Lecture 3:Polygon Triangulation
l-MonotoneConvex polygons are easy to triangulate.
Unfortunately the partition into convex pieces is just as difficult as the triangulation.
l-monotone
l
P
A simple polygon is called monotone w.r.t. a line l if for any line l´ perpendicular to l the intersection of the polygon with l´ is connected (y-monotone, if l = y-axis).
Observation: if P is y-monotone then P Consists of two y-monotone chains.
Computational GeometryProf. Dr. Th. Ottmann
5Lecture 3:Polygon Triangulation
Two steps for triangulation
1. Divide P into y-monotone parts P1,...,Pk
2. Triangulate P1,...,Pk
Computational GeometryProf. Dr. Th. Ottmann
6Lecture 3:Polygon Triangulation
Split and merge vertices
= start vertex
= end vertex
= regular vertex
= split vertex
= merge vertex
2
Computational GeometryProf. Dr. Th. Ottmann
7Lecture 3:Polygon Triangulation
Lemma: A polygon is y-monotone if it has no split vertices ormerge vertices.
Proof: Suppose P is not y-monotone ⇒ there is a horizontalline l that intersects P in more than one connectedcomponent.
We show that P must have at least one split or merge vertex:
• • •p q r
P
•split vertex
(a)l• • •r = p
P
q r´
•merge vertex
(b)
Computational GeometryProf. Dr. Th. Ottmann
8Lecture 3:Polygon Triangulation
(a) r ≠ p ⇒ there exists a split node between q and r.
(b) r = p ⇒ there exists a r´ (go downward) and thus a merge node.
Start with q to r achieved (go upward)
p q p q
Computational GeometryProf. Dr. Th. Ottmann
9Lecture 3:Polygon Triangulation
Five types of vertices
= start vertex
= end vertex
= regular vertex
= split vertex
= merge vertex
Computational GeometryProf. Dr. Th. Ottmann
10Lecture 3:Polygon Triangulation
Removal of Split and Merge nodes
helper(ej) is lowest vertex above the sweep line such that the horizontalsegment connecting the vertex to ejlies inside P.
ej
helper(ej)ek
viei-1
••
ei
l
ej
ekvi
vm
••
Merge-nodes are split nodes inreverse. vi is the new helperof ej . We would like to connectvi to the highest vertex below thesweep line in between ej and ek
Computational GeometryProf. Dr. Th. Ottmann
11Lecture 3:Polygon Triangulation
Example
• • • •
•• •
••
• •
•
•
••
ab
cd
e fg
h
ij k
l m
n o
v T helpera ad ad = ab ad,bc bc = bc ad,ce ce = cd ce ce = de ! ei ei = ef eig ei,gl gl = gh ei,gli gl gl = ij ! gl,jo jo = gl = jk gll ln ln = lm ! ln,mo ln = mo = mn moo
Computational GeometryProf. Dr. Th. Ottmann
12Lecture 3:Polygon Triangulation
Algorithm: MakeMonotone
Input: A simple polygon P stored in a doubly-connected edge list D
Output: A partitioning of P into monotone sub-polygons, stored in D
Construct a priority queue Q on the vertices of P.
Initialize an empty binary search tree T.
while Q is not empty
do remove the vertex vi with highest priority from Q
call appropriate procedure to handle the vertex.
3
Computational GeometryProf. Dr. Th. Ottmann
13Lecture 3:Polygon Triangulation
Handling start, end and split vertices
HandleEndVertex(vi): if (helper(ei-i) is merge vertex)then insert diagonal connecting vi to helper(ei-1) in D. T = T-ei-1
HandleStartVertex(vi): T = T ∪ ei, helper(ei) = vi
HandleSplitVertex(vi): Search in T to find the edge directlyleft of vi
Insert the diagonal connecting vi to helper(ej) in D.
helper(ej) = vi
Insert ei in T and set helper(ei) to vi
Computational GeometryProf. Dr. Th. Ottmann
14Lecture 3:Polygon Triangulation
Handling merge vertices
HandleMergeVertex(vi) : if helper(ei-1) is a merge vertexthen Insert diagonal connecting vi to
helper(ei-1) in D.
Delete ei-1 from T.
Search in T to find the edge ej left of vi .
if helper(ej) is a merge vertexthen Insert diagonal connecting vi to
helper(ej) in D.
helper(ej) = vi
Computational GeometryProf. Dr. Th. Ottmann
15Lecture 3:Polygon Triangulation
Handling regular vertices
HandleRegularVertex(vi) : if the interior of P lies to the right of vithen if helper(ei-1) is a merge vertex
then Insert the diagonal connecting vi to helper(ei-1) in D
delete ei-1 from T.insert ei in T and set helper(ei) to vi.
else search in T to find the edge ej left of viif helper(ej) is a merge vertex
then insert the diagonal connectingvi to helper(ej) in D
helper(ej) = vi
Computational GeometryProf. Dr. Th. Ottmann
16Lecture 3:Polygon Triangulation
Correctness of HandleSplitVertex
•
•Q ekej
vm
vi
Consider a segment vmvi that is added when vi is reached by HandleSplitVertex. Let ej be the edge to left of vi, and let ek be the edge to right of vi . helper(ej) = vm when we reach vi .Argument : vmvi does not intersect an edge of PConsider the quadrilateral Q, there are no verticesof P inside Q, else vm would not be helper of ej . Suppose an edge of P intersects vmvi then itwould have to intersect a segment connecting vi to ej but this is impossible.Since there are no vertices of P inside Q, no edge of P can intersect vmvi
Computational GeometryProf. Dr. Th. Ottmann
17Lecture 3:Polygon Triangulation
Theorem
A simple polygon with n vertices can be partitioned into y-monotone polygons in O(n log n) time with an algorithm that uses O(n) storage.
1
Computational GeometryProf. Dr. Th. Ottmann
1Lecture 3:Polygon Triangulation
l-MonotoneConvex polygons are easy to triangulate.
Unfortunately the partition into convex parts is just as difficult as the triangulation.
l-monotone
l
P
A simple polygon is called monotone w.r.t. a line l if for any line l´ perpendicular to l the intersection of the polygon with l´ is connected (y-monotone, if l = y-Axis).
Observation: P is y-monotone.
Computational GeometryProf. Dr. Th. Ottmann
2Lecture 3:Polygon Triangulation
Two steps for triangulation
1. Divide P into y-monotone parts P1,...,Pk
2. Triangulate P1,...,Pk
Computational GeometryProf. Dr. Th. Ottmann
3Lecture 3:Polygon Triangulation
Split and Merge Vertices
= start vertex
= end vertex
= regular vertex
= split vertex
= merge vertex
Computational GeometryProf. Dr. Th. Ottmann
4Lecture 3:Polygon Triangulation
Five Types of Vertices
••
••
••
• •
•
••
•
•
•
•
• = start vertex
• = end vertex
• = regular vertex
• = split vertex
• = merge vertex
Computational GeometryProf. Dr. Th. Ottmann
5Lecture 3:Polygon Triangulation
Theorem
A simple polygon with n vertices can be partitioned into y-monotone polygons in O(n log n) time with an algorithm that uses O(n) storage.
Computational GeometryProf. Dr. Th. Ottmann
6Lecture 3:Polygon Triangulation
Triangulation of y-monotone Polygon
Idea: Fan so long build to convexity hurtsalternation from right and left side
not yet triangulated
Implementation: Scan-line uses stack asdata structure
Case 1: Page overflows Case 2: resembles page
poppedpushed
2
Computational GeometryProf. Dr. Th. Ottmann
7Lecture 3:Polygon Triangulation
Examplea
b
c d e
f h i
j k l m n o
p
q r
s t
u v
w x
Batches : ba
c : ba → ca
d : ca → dc
e : dc → ed
g
Computational GeometryProf. Dr. Th. Ottmann
8Lecture 3:Polygon Triangulation
a
b cd
e
f
g
h
i
j
Computational GeometryProf. Dr. Th. Ottmann
9Lecture 3:Polygon Triangulation
Implementation
1. S.push(u1), S.push(u2)2. for j = 3,...,n-13. if (side(uj) ≠ side(S.top))4. while (S ≠ ∅) v = S.pop, diag(uj,v)5. S.push(uj-1) 6. S.push(uj)7. else8. while (diag(S.top, uj) in P)9. diag(S.top, uj)10. S.pop11. S.push(last)12. S.push(uj)
uj
uj
Theorem: time O(n)
Proof: number of pops < number of pushes
Computational GeometryProf. Dr. Th. Ottmann
10Lecture 3:Polygon Triangulation
Theorem
Theorem: A strictly y-monotone polygon with n vertices can betriangulated in O(n) time.
Theorem: A simple polygon with n vertices can be triangulated in O(n log n) with an algorithm that uses O(n) storage.
Theorem: A planar subdivision with n vertices in total can be triangulated in O(n log n) time with an algorithm thatuses O(n) storage.
Computational GeometryProf. Dr. Th. Ottmann
11Lecture 3:Polygon Triangulation
Computational Geometry Algorithms Library
Kernel
2D/3D point, vector, direction, segment, ray, line, dD point, triangle, bounding box,iso-rectangle, circle, plane, tetrahedron, predicates, affine transformations, intersection and distance calculation
http://www.cs.uu.nl/CGAL
Basic Library
half edge data structure, topological map, planar map, polyhedron, Boolean operations on polygons, planar map overlay, triangulation, Delauney triangulation, 2D/3D convex hull, and 2D extreme points, smallest enclosing circle/sphere and ellipse, maximum inscribedk-gon, and other optimizations, range tree, segment tree, kD tree
1
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
1
Linear Programming
Overview
• Formulation of the problem and example • Incremental, deterministic algorithm • Randomized algorithm • Unbounded linear programs • Linear programming in higher dimensions
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
2
Problem descriptionMaximize c1x1 + c2x2 + ... + cdxd
Subject to the conditions: a1,1x1 + ... a1,dxd ≤ b1a2,1x1 + ... a2,dxd ≤ b2
: : :an,1x1 + ... an,dxd ≤ bn
Linear program of dimension d:c = (c1,c2,...,cd)hi = (x1,...,xd) ; ai,1x1 + ... + ai,dxd ≤ bi
li = hyperplane that bounds hi ( straight lines, if d=2 )H = h1, ... , hn
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
3
ExampleProduction of two goods A and B using four raw materials Value of A: 6 CU, value of B: 3 CU
223
6 2 4
212
24 5
Prod AProd BReserve
Rm4Rm3Rm2Rm1
Maximize profit: fc (x) = 6xA + 3xB under the conditions:xA, xB = 0xA = 0, xB2xA + 4xB ≤ 5
2xA + 1xB ≤ 26xA + 2xB ≤ 42xA + 2xB ≤ 3
xA, xB ≥ 0Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
4
Chart
(3/2, 0)(0, 3/2)4(2/3, 0)(0, 2)3(1, 0)(0, 2)2
(5/2, 0)(0, 5/4)1(xA, xB)(xA, c)Ii
2
3/2
5/41
1/2
1/22/3 1 3/2 2 5/2 xB
xA
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
5
Structure of the feasible region
1. Bounded
2. Unbounded
3. Empty
C
C
C
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
6
Result
Four possibilities for the solution of a linear program
1. A vertex of the feasible region is the only solution. 2. One edge of the feasible region contains all
solutions. 3. There are no solutions. 4. The feasible region is unbounded toward the
direction of optimization.
In case 2: Choose the lexicographically minimum solution = > corner
2
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
7
Structure of the feasible region
1. Bounded
2. Unbounded
3. Empty
C
C
C
1
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
1
Linear Programming
Overview
• Formulation of the problem and example • Incremental, deterministic algorithm • Randomized algorithm • Unbounded linear programs • Linear programming in higher dimensions
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
2
Problem descriptionMaximize c1x1 + c2x2 + ... + cdxd
Subject to the conditions: a1,1x1 + ... a1,dxd ≤ b1a2,1x1 + ... a2,dxd ≤ b2
: : :an,1x1 + ... an,dxd ≤ bn
Linear program of dimension d:c = (c1,c2,...,cd)hi = (x1,...,xd) ; ai,1x1 + ... + ai,dxd ≤ bi
li = hyperplane that bounds hi ( straight lines, if d=2 )H = h1, ... , hn
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
3
Structure of the feasible region
1. Bounded
2. Unbounded
3. Empty
C
C
C
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
4
Assumption :
Algorithm UnboundedLP(H, c ) yields either
a) a ray in ∩ H, which is unbounded towards c , or
b) two half planes h1 and h2, so that h1 ∩ h2 is bounded towards c, or
c) the answer, that LP(H, c ) has no solution, because the feasible region is empty.
Bounded linear programs
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
5
Let C2 = h1 ∩ h2Remaining half planes: h3,..., hnCi = Ci-1 ∩ hi = h1 ∩ ... ∩ hi
Compute-optimal-vertex (H, c)v2 := l1∩ l2 ; C2 := h1 ∩ h2for i := 3 to n do
Ci := Ci-1 ∩ hivi := optimal vertex of Ci
C2 ⊇ C3 ⊇ C4 ... ⊇ Cn = CCi = ∅ ⇒ C = ∅
Incremental algorithm
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
6
Optimal Vertex
Lemma 1: Let 2 < i ≤ n, then we have : 1.If vi-1 ∈ hi, then vi =vi-1.2.If vi-1 ∉ hi, then either Ci = ∅ or vi ∈ li,
where li is the line bounding hi.
2
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
7
Optimal Vertex
h1
h2
h3
h4
v3= v4
c
h1
h2
h3
h4
h5
c
v4 v5
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
8
fc(x) = c1x1 + c2x2
vi-1
Ci-1
Next optimal vertex
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
9
Algorithm 2D-LPInput: A 2-dimensional Linear Program (H, c )Output: Either one optimal vertex or ∅ or a ray
along which (H, c ) is unbounded.
if UnboundedLP(H, c ) reports (H, c ) is unbounded or infeasiblethen return UnboundedLP(H, c )else report h1 := h; h2 := h´ ; v2 := l1 ∩ l2let h3,...,hn be the remaining half-planes of Hfor i:= 3 to n do
if vi-1 ∈ hi then vi:=vi-1else Si-1:= Hi-1 ∩* livi:= 1-dim-LP(Si-1, c ) if vi not exists then return ∅
return vnRunning time: O(n²)
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
10
Algorithm 1D-LPFind the point x on li that maximizes cx , subject to the constraints x ∈ hj, for 1 ≤ j < i –1Observation: li ∩ hj is a rayLet Si-1 := h1∩ li, ..., hi-1 ∩ li
Algorithm 1D-LPSi-1, c
p1 = s1for j := 2 to i-1 do pj = pj-1∩ sjif pi-1 ≠ ∅ then
return the optimal vertex of pi-1 elsereturn ∅
Time: O(i)
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
11
Addition of halfplanes in different orders
1 23 45 67 89 1011 12
vi
Good
1 23 45 67 89 10
11 12Bad
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
12
Optimal vertex
h1
h2
h3
h4
v3= v4
c
h1
h2
h3
h4
h5
c
v4 v5
3
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
13
Algorithm 2D-LPInput: A 2-dimensional Linear Program (H, c )Output: Either one optimal vertex or ∅ or a ray
along which (H, c ) is unbounded.
if UnboundedLP(H, c ) reports (H, c ) is unbounded or infeasiblethen return UnboundedLP(H, c )else report h1 := h; h2 := h´ ; v2 := l1 ∩ l2let h3,...,hn be the remaining half-planes of Hfor i:= 3 to n do
if vi-1 ∈ hi then vi:=vi-1else Si-1:= Hi-1 ∩* livi:= 1-dim-LP(Si-1, c ) if vi not exists then return ∅
return vnRunning time: O(n²)
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
14
Addition of halfplanes in different orders
1 23 45 67 89 1011 12
vi
Good
1 23 45 67 89 10
11 12Bad
1
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
1
Linear Programming
Overview
• Formulation of the problem and example • Incremental, deterministic algorithm • Randomized algorithm • Unbounded linear programs • Linear programming in higher dimensions
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
2
Algorithm 2D-LPInput: A 2-Dimensional Linear Program (H, c )Output: Either one optimal vertex or ∅ or a ray
along which (H, c ) is unbounded.if UnboundedLP(H, c ) reports (H, c ) is infeasible
then return UnboundedLP(H, c )else h1 := h; h2 := h´ ; v2 := l1 ∩ l2
h3,...,hn := remaining half-planes of Hfor i:= 3 to n do
if vi-1 ∈ hithen vi:=vi-1else Si-1:= Hi-1 ∩* li
vi:= 1-dim-LP(Si-1, c ) if vi not exists then return ∅
return vnRunning time: O(n²)
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
3
New problemFind the point x on li that maximizes cx , subject to the constraints x ∈ hj, for 1 ≤ j < i –1Observation: li ∩ hj is a rayLet Si-1 := h1∩ li, ..., hi-1 ∩ li
1. 1-dim-LPSi-1, c
2. p1 = s13. for j := 2 to i-1 do4. pj = pj-1∩ sj5. if pi-1 ≠ ∅ then6. return the optimal vertex of pi-1 else7. return ∅
Time: O(i)Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
4
Sequences
1 23 45 67 89 101
112
vi
Good
1 23 45 67 89 1
0
11
12
Bad
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
5
Optimal Vertex
h1
h2
h3
h4
v3= v4
c
h1
h2
h3
h4
h5
c
v4
v5
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
6
Algorithm 2D-LPInput: A 2-Dimensional Linear Program (H, C )Output: Either one optimal vertex or ∅ or a ray
along which (H, C ) is unbounded.if UnboundedLP(H, C ) ≠ h, h´then return UnboundedLP(H, C )
h1 := h; h2 := h´ ; v2 := l1 ∩ l2h3,...,hn := remaining half-planes of Hfor i:= 3 to n do
if vi-1 ∈ hithen vi := vi-1else Si-1 := Hi-1 ∩* li
vi:= 1-dim-LP(Si-1, C ) if vi does not exist then return ∅
return vnRunning time: O(n²)
2
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
7
Sequences
1 23 45 67 89 101
112
vi
Good
1 23 45 67 89 1
0
11
12
Bad
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
8
Algorithm 2D-LPInput: A 2-Dimensional Linear Program (H, C )Output: Either one optimal vertex or ∅ or
a ray along which (H, C ) is unbounded.if UnboundedLP(H, C ) ≠ h, h´ thenreturn UnboundedLP(H, C )h1 := h; h2 := h´ ; v2 := l1 ∩ l2h3,...,hn := remaining half-planes of Hcompute a random permutation h3, ..., hn
for i:= 3 to n doif vi-1 ∈ hi then vi:=vi-1else Si-1 := Hi-1 ∩* li
vi := 1-dim-LP(Si-1, C ) if vi does not exist then
return ∅return vnRunning time: O(n²)
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
9
Randomization
Theorem: The 2-dimensional linear programming problem with nconstraints can be solved in O(n) randomized expected time using worst-case linear storage.
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
10
Random Variable xi
Xi = i 1i h inv if 1otherwise 0
−
∑=
•n
iX)i(O
3i
[ ]∑∑==
•Ο=
•Ο
n
ii
n
ii xE)i(X)i(E
33
E[xi] is the probability that vi-1 ∉ hi
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
11
Algorithm 2D-LPInput: A 2-Dimensional Linear Program (H, C )Output: Either one optimal vertex or ∅ or a ray
along which (H, C ) is unbounded.if UnboundedLP(H, C ) ≠ h, h´then return UnboundedLP(H, C )
h1 := h; h2 := h´ ; v2 := l1 ∩ l2h3,...,hn := remaining half-planes of Hfor i:= 3 to n do
if vi-1 ∈ hithen vi := vi-1else Si-1 := Hi-1 ∩* li
vi:= 1-dim-LP(Si-1, C ) if vi does not exist then return ∅
return vnRunning time: O(n²)
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
12
Unbounded Linear Programs
hi
ϕi
:=The outward normal of hi
ϕi := The smaller angle that η makes with c
Imin, an index with
ϕi min = min ϕj,1 ≤ j ≤ n
η
η
c
3
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
13
Hmin := hj ∈H | = min
Hpar := hj ∈ H | = - min
jηr
i ηr
jηr
i ηr
cr
Hpar
Hmin
*ih
Hpar
Hmin
hi*c
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
14
Lemma
Let H = h1,h2,...,hn be a set of half-planes.
Assuming that ∩(Hmin ∪ Hpar) is not empty.
1. If li* ∩ hj* is unbounded in the direction c for every half-plane hj in the set H\ (Hmin ∪ Hpar), then (H, c ) is unbounded along a ray contained in li* .
2. If li* ∩ hj* is bounded in the direction c for some hj* in
H\ (Hmin ∪ Hpar), then the linear program (hi* , hj*, c )
is bounded.
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
15
Algorithm UNBOUNDEDLPInput: A 2-Dimensional Linear Program (H, C )
Output: Either one optimal vertex or ∅ or a ray along which (H, C ) is unbounded.
1. For each half plane hi ∈ H compute ∅j2. Let hi be half plane with ∅j = min ∅j,1 ≤ j ≤ n3. Hmin := hj ∈H | = min4. Hpar := hj ∈ H | = - min5. = H\ (Hmin ∪ Hpar), compute intersection in Hmin ∪ Hpar6. If the intersection is empty
then report (H, C ) is feasibleelse Let hi∈ Hmin be the half-plane whose line bound
the intersectionif there is half plane hj*∈ suchthat li*∩hj* bounded in C
then report (hi* , hj*, C ) is boundedelse report is bounded along li* ∩(∩ )
H
H
H
jηr
jηr i η
r
i ηr
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
16
Higher Dimensions
Let h1,...,hd H be the d certificate half-spaces thatUNBOUNDEDLP returns.
Ci := h1∩ h2 ∩ ... ∩ hi
Lemma: Let d < i ≤ n, and let Ci be defined as above.
1. If vi-1∈ hi, then vi = vi-1
2. If vi-1∉ hi, then either Ci= ∅ or vi∈ gi, where gi is the
hyperplane that bounds hi.
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
17
Algorithm RANDOMIZEDLPInput : A linear program (H, c ).
Output : Either one optimal vertex or ∅ or a ray along which (H, c ) is unbounded.
if UNBOUNDEDLP(H, c ) reports (H, c ) is unbounded
then Report the information and, ray along which (H, c ) isunbounded.
else Let h1,...,hd ∈ H he the certificate halfplanes returned byUNBOUNDEDLP, and let vd be their vertex of intersection
Compute a random permutation hd+1,...,hn
for i = d+1 to ndo if vi-1 ∈ hi
then vi = vi-1else vi = the point p on gi that maximizes f (p)
if p does not existthen report infeasible and quit.
Return vn
cr
Lecture 4:Linear Programming
Computational GeometryProf. Dr. Th. Ottmann
18
Theorem
The d-dimensional linear programming problem with
n constraints can be solved in O(d!n) expected time
using linear storage.
1
1Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Orthogonal Range Searching
1. Linear Range Search : 1-dim Range Trees
2. 2-dimensional Range Search : kd-trees
3. 2-dimensional Range Search : 2-dim Range Trees
4. Range Search in Higher Dimensions
2Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Range search
Salary
Children
Age
Input: Set of data points in d-space, orthogonal (iso-oriented) query range R
Output: All points contained in R
3Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Binary search tree (1-dimensional)
4Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Binary leaf search tree
5Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Range search
6Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
1-Dimensional range query
Finding the split node for query range [x, x´]
FindSplitNode (T, x, x´)
v = root (T)
while not leaf(v) && (x´ ≤ v.x || x > v.x)
if (x´ ≤ v.x) then v = left(v)
else v = right(v)
return v
Running time : O(log n)
Note : Only O(log n) subtrees
fall into the query range.
2
7Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Example – Binary Search Tree
49
23 80
10 37
193
3 10 19 23
30
30 37
49
62
59 70
59 62 70 80
89
89 95
95 97
Split nodeQuery range: [22, 77]
8Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Algorithm 1-d-range-search1DRangeQuery (T, [x, x´])
vsplit = FindSplitNode (T, x, x´)
if ( leaf (vsplit) && vsplit in R=[x, x´])
then write vsplit;
return;
v = left-child(vsplit);
while (not leaf (v))
if (x ≤ v.x )
then write Subtree (right-child(v));
v= left-child(v);
else v = right-child(v)
if (v in R) write v ;
v = right-child(vsplit) ...
rchild(v)
s
v
px x´
9Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Theorem
A 1-dim range query in a set of n points can be answered in time O(log n + k) using a 1-d-range tree, where k is the number of reported points which fall into the given range.
Proof :FindSplitNode: O(log n) Leaf search: O(log n)The number of green nodes is O(k), since number of internal nodes is O(k) ⇒ O((log n)+k) total time.
10Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Summary
Let P be a set of n points in 1-dimensional space. The set P can be stored in a balanced binary search tree,which uses O(n) storage and has O(n log n) construction time, such that the points in a query range can be reportedin time O(k + log n) , where k is the number of reported points.
1
1Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Orthogonal Range Searching
1. Linear Range Search : 1-dim Range Trees
2. 2-dimensional Range Search : kd-trees
3. 2-dimensional Range Search : 2-dim Range Trees
4. Range Search in Higher Dimensions
2Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Range search
Salary
Children
Age
Input: Set of data points in d-space, orthogonal (iso-oriented) query range R
Output: All point contained in R
3Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
2 – dimensional range search
Assumption :
No two points have the same x- ory-coordinates
4Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Construction of kd-trees
1 p
1
2
3
4 5
7
68
9
101
1,2,3,4,5 6,7,8,9,10P1 P2
5Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Construction of kd-trees
15 7
2
6
8
4
3
91
2
3
4 5
67 8
9
10
1 2
3 4 5
6 7
8 9 10
1
2 3
4 5 6 7
8 9
6Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Algorithm for building 2d-trees
BuildTree (P, depth)
if (|P| = 1) return leaf(P)
if (depth even) split P into P1,P2
through vertical median
else split P into P1,P2 through
horizontal median
v1 = BuildTree (P1, depth + 1)
v2 = BuildTree (P2, depth + 1)
return (v1 , median , v2 )
2
7Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Theorem: The algorithm for constructing a 2d-tree uses O(n) storageand can be carried out in time O(n log n)
Proof:Space: 2d-tree is a binary tree with n leaves.Time:
O(1) , if n =1T(n) =
O(n) + 2T(n/2) , if n > 1
T(n) <= cn + 2T(n/2) <= cn + 2(cn/2 + 2T(n/4)) <= .......= O(n log n)
Analysis
8Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Nodes represent regions15 7
2
6
8
4
3
91
2
3
4 5
67 8
9
101
2 3
4 5 6 7
8 9
1 2
3 4 5
6 7
8 9 10
below
left right
above
Regions: Region(5) is left of 1 and above 2
Incremental ............ : Region(left(v)) = left(v) ∩ Region(v)
9Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Algorithm search in a 2d-tree
15 7
2
6
8
4
3
91
2
3
4 5
67 8
9
10
1
2 3
4 5 6 7
8 9
1 2
3 4 5
6 7
8 9 10
SearchTree(v,R)
if (leaf(v) && v in R) then write v; return
if (Region(left(v)) in R ) then write Subtree(left(v)), return
if (Region(left(v)) ∩ R <> ∅) then SearchTree(left(v), R)
if (Region(right(v)) in R) then write Subtree(right(v)),return
if (Region(right(v)) ∩ R <> ∅ ) then SearchTree(right(v),R)
10Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Analysis algorithm search in 2d-treeLemma : A query with an axis-parallel rectangle in a 2d-tree storing n points can be performed in time, where k is the number of reproted points.
( )kn +Ο
Proof : B = # of blue nodes, G = # of green nodesG(n) = O(k).B(n) ≤ # of vertical intersection regions V +
# of horizontal intersection regions H Line l intersects either the region to left of
root(T) or to the right. This gives the following recursion:
V(n) = O(1) , if n = 1= 2 + 2V(n/4), if n > 1
V(n) = 2 + 4 + 8 + 16 + ... + 2log4n
= 2 + 4 + 8 + 16 + ... + √n = O(√n)
11Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
V
# of regions in a 2d-tree with n points, which are intersectedby a vertical straight line.
V(1)= 1
V(n)= 2+ 2V(n/4)
12Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Summary
A 2d-tree for a set P of n points in the plane uses
O(n) storage and can be built in O(n log n) time.
A rectangular range query on the 2d-tree takes( )kn +Ο time, where k is number of reported points.
1
1Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Orthogonal Range Searching
1. Linear Range Search : 1-dim Range Trees
2. 2-dimensional Range Search : kd-trees
3. 2-dimensional Range Search : 2-dim Range Trees
4. Range Search in Higher Dimensions
2Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Range Trees
Two Dimensional Range Search
y
x
Assumption:no two points have thesame x or y coordinates
3Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Canonical subset of a node
V
Vsplit
P(v) = set of points of thesubtree with root v.
4Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Associated tree
X
Y
5Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Range tree for a set P
1. The main tree (1st level tree) is a balanced binary search tree T built on the x – coordiante of the points in P.
2. For any internal or leaf node v in T, the canonicalsubset P(v) is stored in a balanced binary searchtree Tassoc(v) on the y – coordinate of the points.The node v stores a pointer to the root of Tassoc(v)which is called the associated structure of v.
6Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Constructing range trees
V
p
T (x – sorted) T´(v) (y – sorted)
For all nodes in T store entirepoint information.All nodes y - presorted
Build2DRangeTree(P)1. Construct associated tree T´ for the
points in P (based on y-coordinates)2. If (P = 1) then return leaf(P), T´(leaf(P))
else split P into P1, P2 via median xv1 = Build2DRangeTree(P1)v2 = Build2DRangeTree(P2)create node v, store x in v, left-child(v) =v1,right-child(v) = v2 associate T´ with v
2
7Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Lemma
Statement : A range tree on a set of n points in the planerequires O(n log n) storage.
Proof : A point p in P is stored only in the associated structure of nodes on the path in T towards theleaf containing p. Hence, for all nodes at a givendepth of T, the point p is stored in exactly oneassociated structure. We know that 1 – dimensionalrange trees use linear storage, so associatedstructures of all nodes at any depth of T together use O(n) storage. The depth of T is O(log n).Hence total amount of storage required is O(n log n).
8Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Search in 2-dim-range treesAlgorithm 2DRangeQuery(T,[x : x´] × [y : y´])
vsplit = FindSplitNode(T,x,x´)if (leaf(vsplit) & vsplit is in R) then report v, return
else v = left-child(vsplit)
while not (leaf(v))
do if (x ≤ xv)then 1DRangeQuery(Tassoc( right-child(v)),[ y : y’])
v = left-child(v)
else v = right-child(v)
if (v is in R) then report v
v = right-child(vsplit) ... Similarly …
9Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
AnalysisLemma: A query with an axis – parallel rectangle in a range tree storing n points takes O(log²n + k) time, where k is the number of reported points.
Proof : At each node v in the main tree T we spend constanttime to decide where the search path continues and evt. call1DRangeQuery. The time we spend in this recursive call isO(log n + kv) where is kv the number of points reported in this call. Hence the total time we spend is
∑ +Οv
vkn )(log
Furthermore the search paths of x and x´in the main tree T have length O(log n). Hence we have
∑ Ο=Οv
nn )(log)(log 2
10Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Higher-dimensional range trees
Time required for construction: T2(n) = O( n log n)Td(n) = O( n log n) + O( log n) * Td-1(n)
⇒Td(n) = O( n logd-1 n)
Time required for range query (without time to report points):Q2(n) = O( log2 n)Qd(n) = O( log n) + O( log n) *Q d-1(n)
⇒ Qd(n) = O( logd n)
11Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Search in SubsetsGiven : Two ordered arrays A1 and A2.
key(A2) ⊂ key(A1)query[x, x´]
Search : All elements e in A1 and A2with x ≤ key(e) ≤ x´.
Idea : pointers between A1 and A2
Example query : [20 : 65]
95908070625937302319103
90807062301910
Run time : O(log n + k)
Run time : O(1 + k)
12Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Fractional Cascading
Idea : P1 ⊂ P, P2 ⊂ P
9980623719103
80371910 99623
8019 3710 993 62
99337108019
3
13Lecture 5:Orthogonal Range Searching
Computational GeometryProf. Dr. Th. Ottmann
Fractional Cascading
8
8
5 15
2 7 12 17
2 5 7 12 15319 80 10 37 99
62
x-value
y-value
Theorem : query time can be reducedto O(log n + k).
Proof : In d dimension a saving of one log n factor is possible.
1
1Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Point Location
1. Trapezoidal decomposition.
2. A search structure.
3. Randomized, incremental algorithm for the
construction of the trapezoidal decomposition.
4. Analysis.
2Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Point location in a map
3Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Partition of the plane into slabs
Query time : O(log n)binary search in x and then binary search in y direction.
Storage space O(n2)
n/2
n/2
4Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Partitioning into Trapezoids
Assumption :Segments are in „general position“
Observation : Every vertical edge hasone point in commonwith a segment end.
R
5Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Observations
Rf
f is convex
f is bounded
Every non - vertical sideof f is part of a segment of S or an edge of R
6Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Trapezoidal decomposition of set of line segments
Lemma : Each face in a trapezoidal map of a set S of line segmentsin general position has 1 or 2 vertical sides and exactlytwo non-vertical sides
2
7Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
For every trapezoid ∆ ∈T(S), except the left most one, the left verticaledge of ∆ is defined by asegment endpoint p,denoted by leftp(∆) .
R
Left edge of a trapezoid
8Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
5 Cases (For left edge of a trapezoid)
a) top(∆)
bottom(∆)
leftp(∆)
b) leftp(∆)top(∆)
d)
leftp(∆)
top(∆)c)
leftp(∆)
top(∆)
bottom(∆)bottom(∆)
bottom(∆)
e) It is left edge of R. This case occurs for a single trapezoid of T(S) only, namely the unique leftmost trapezoid of T(S)
9Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Size of the trapezoidal map
Theorem: The trapezoidal map T(S) of a set of n line segments in general position contains at most 6n + 4 vertices and at most 3n + 1trapezoids.
Proof (1): A vertex of T(S) is either
- a vertex of R or 4
- an endpoint of a segment in S or 2n
- a point where the vertical extension startingin an endpoint abuts on another segmentor on the boundary R. 2 * (2n)
6n + 4
10Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Proof (2): Each trapezoid has a unique point leftp(∆), which is
- the lower left corner of R
- the left endpoint of a segment (can be leftp(∆) of at most two different trapezoids)
- the right endpoint of a segment (can be leftp(∆) of atmost one trapezoid)
1
2n
n
3n + 1
Theorem: The trapezoidal map T(S) of a set of n line segments in general position contains at most 6n + 4 vertices and at most 3n + 1trapezoids.
Size of the trapezoidal map
1
1Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Point Location
1. Trapezoidal decomposition.
2. A search structure.
3. Randomized, incremental algorithm for the
construction of the trapezoidal decomposition.
4. Analysis.
2Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Point location in a map
3Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Partition of the plane into slabs
Query time : O(log n)binary search in x and then binary search in y direction.
Storage space O(n2)
n/2
n/2
4Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Partitioning into Trapezoids
Assumption :Segments are in „general position“
Observation : Every vertical edge hasone point in commonwith a segment end.
R
5Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Observations
Rf
f is convex
f is bounded
Every non - vertical sideof f is part of a segment of S or an edge of R
6Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Trapezoidal decomposition of set of line segments
Lemma : Each face in a trapezoidal map of a set S of line segmentsin general position has 1 or 2 vertical sides and exactlytwo non-vertical sides
2
7Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
For every trapezoid ∆ ∈T(S), except the left most one, the left verticaledge of ∆ is defined by a segment endpoint p, denoted by leftp(∆) .
R
Left edge of a trapezoid
8Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
5 Cases (For left edge of a trapezoid)
a) top(∆)
bottom(∆)
leftp(∆)
b) leftp(∆)top(∆)
d)
leftp(∆)
top(∆)c)
leftp(∆)
top(∆)
bottom(∆)bottom(∆)
bottom(∆)
e) It is left edge of R. This case occurs for a single trapezoid of T(S) only, namely the unique leftmost trapezoid of T(S)
9Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Size of the trapezoidal map
Theorem: The trapezoidal map T(S) of a set of n line segments in general position contains at most 6n + 4 vertices and at most 3n + 1 trapezoids.
Proof (1): A vertex of T(S) is either
- a vertex of R or 4
- an endpoint of a segment in S or 2n
- a point where the vertical extension startingin an endpoint abuts on another segmentor on the boundary R. 2 * (2n)
6n + 4
10Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Proof (2): Each trapezoid has a unique point leftp(∆), which is
- the lower left corner of R
- the left endpoint of a segment (can be leftp(∆) of at most two different trapezoids)
- the right endpoint of a segment (can be leftp(∆) of atmost one trapezoid)
1
2n
n
3n + 1
Theorem: The trapezoidal map T(S) of a set of n line segments in general position contains at most 6n + 4 vertices and at most 3n + 1 trapezoids.
Size of the trapezoidal map
11Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Adjacent trapezoidsTwo trapezoids ∆ and ∆´ are adjacent if they meet along a vertical edge.
∆∆1
∆2 ∆3∆4
∆5
∆
∆1∆2
∆3
∆4
∆5
∆6
1) Segments in general position :A trapezoid has atmost four adjacent trapezoids
2) Segments not in general position:A trapezoid can have an arbitrary number of adjacent trapezoids.
12Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Vertical neighbors:Upper, lower left neighbor
Trapezoid ∆' is (vertical) neighbor of ∆
top(∆) = top(∆’) or bottom(∆) = bottom(∆’)
In the first case ∆´ is upper left neighborof ∆, in the second case ∆´ is lower left neighbor of ∆.
3
13Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Representing trapezoidal maps
There are records for all line segments and endpoints of S,the structure contains records for trapezoids of T(S), but not for vertices or edges of T(S).
The record for trapezoid ∆ stores pointers to top(∆), and bottom(∆) , pointers to leftp(∆) and rightp(∆) and finally pointers to its atmost 4 neighbors.
∆ is uniquely defined by top(∆), bottom(∆), leftp(∆) andrightp(∆).
14Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
A search structure
A B
C
D
E
F G1l1r
2l2r
A
B
C
D
E
F
G
1l
1r
2r
2l
1
2
2
End points decide between left, rightSegments decide between below, above
15Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Example : Search structure
A B
C
D
E
F G1l1r
2l2r
16Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
A randomized incremental algorithmInput : A set S of n non-crossing line segmentsOutput : The trapezoidal map T(S) and a search structure D(S)
for T(S) in a bounding box.Determine a bounding box R, initialize T and D
Compute a random permutation s1,s2, ..., sn of the elements of S
for i = 1 to n do add si and change T(Si - 1) into T(Si) and D(Si -1) into D(Si)
Invariant :In the step i T(Si) is correct trapezoidal map of Siand D(Si) is an associated search structure.
17Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
A randomized incremental algorithmInput : A set of n non-crossing line segmentsOutput : The trapezoidal map T(S) and a search structure D
for T(S) in a bounding box.Determine a bounding box R, initialize T and D
Compute a random permutation s1,s2, ..., sn of the elements of S
for i = 1 to n do Find the set ∆0, ∆1, ... , ∆k of trapezoids in T properly
intersected by si.Remove ∆0, ∆1,..., ∆k from T and replace them by newtrapezoids that appear because of the intersection of si.Remove the leaves for ∆0, ∆1,..., ∆k from D and createleaves for the new Trapezoids.Link the new leaves to the existing inner nodes by addingsome new inner nodes.
18Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Questions
How can we find the intersecting trapezoids?
How can T and D be updated a) if new segment intersects no previous trapezoidb) if new segment intersects previous trapezoids
4
19Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Finding the intersecting trapezoids
∆0si
∆1
∆2 ∆3∆j+1 is lower right neighbour of ∆j
In T(Si) exactly those trapezoids are changed, which are intersected by si
if rightp(∆j) lies above sithen Let ∆j+1 be the lower right neighbor of ∆j.else Let ∆j+1 be the upper right neighbor of ∆j
Clue :∆0 can be found by a query in the search structure D(Si -1) constructed in iteration stage i -1.
20Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
New segment completely contained in trapezoidt
pq
s DecompositionA C B
D
T(Si-1) T(Si)Search structure
D(Si-1) D(Si-1)
t
AB
C D
p
q
s4 new trapezoids, -1 old trapezoid,search depth + 3
21Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
New segment intersects previous ones
p
q
t0 t1 t2 t3s
T(Si - 1)
Decomposition
FA
B C
ED
T(Si)
t0 t1 t2 t3
D(Si - 1)
Search structureD(Si)
A
B
C
D
E
F
s s s s
s
6 new trapezoids, – 4 old,depth + 2
22Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Estimation of the depth of the search structureLet S be a set of n segments in general position,q be an arbitrary fixed query point.
Depth of D(S):worst case : 3n,
average case : O(log n)
Consider the path traversed by the query for q in D
Let Xi = # of nodes on the search path for q created in iteration step i.
Xi <= 3
Pi = probability that there exists node on the search path for q that is created in iteration step i.
E[Xi] <= 3 Pi
23Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
ObservationIteration step i contributes a node to the search path for q exactly if ∆q(Si - 1), the trapezoid containing q in T(Si - 1), is not the same as ∆q(Si) , the trapezoid containing q in T(Si)
Pi = Pr[∆q(Si) ≠ ∆q(Si - 1)].
If ∆q(Si) is not same as ∆q(Si - 1), then ∆q(Si) must be one of the trapezoids created in iteration i.∆q(Si) does not depend on the order in which the segments in Sihave been inserted.
Backwards analysis :
We consider T(Si) and look at the probability that ∆q(Si) disappears from the trapezoidal map when we remove the segment si.
∆q(Si) disappears if and only if one of top(∆q(Si)), bottom(∆q(Si)), leftp(∆q(Si)), or right(∆q(Si)) disappears with removal of si .
24Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Prob[top(∆q(Si))] = Prob[bottom(∆q(Si))] = 1/i.
Prob[leftp(∆q(Si))] disappears is at most 1/i.
Prob[rightp(∆q(Si))] disappears is at most 1/i.
Pi = Pr[∆q(Si) ≠ ∆q(Si - 1)] = Pr[∆q(Si) ∉ T(Si - 1)]
<= 4/i
( )nHii
PXiEn
i
n
n
i
n
i
i
n
i
log121121231111
Ο===≤≤
∑∑∑∑====
5
25Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Analysis of the size of search structure
Leaves in D are in one – to – one correspondence with thetrapezoids in ∆, of which there are O(n).
The total number of nodes is bounded by :
( ) ∑=
+Οn
i
n1
(# of inner nodes created in iteration step i)
The worst case upper bound on the size of the structure
( ) ( ) ( )²1
ninn
i
Ο=Ο+Ο ∑=
26Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Analysis of the size of search stuctureTheorem: The expected number of nodes of D is O(n).
Proof: The # of leaves is in O(n). Consider the internal nodes:Xi = # of internal nodes created in iteration step i
( )
=∆01
:, sδif ∆ disappears from T(Si) when s is removed from Si
otherwise
There are at most four segments that cause a given trapezoid to disappear
( ) ( ) ( )iSTsi iSs ST
i Ο=≤∆∑ ∑∈ ∈∆ )(
4,δ
27Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
[ ] ( ) ( ) ( )1,1)(
Ο=Ο
≤∆= ∑ ∑∈ ∈∆i iSs ST
iiis
ikE δ
The expected number of newly created trapezoids is O(1) inevery iteration of the algorithm, from which the O(n) boundon the expected amount of storage follows.
( )nXiEn
iΟ=
⇒ ∑
=1
28Lecture 6:Point Location
Computational GeometryProf. Dr. Th. Ottmann
Summary
Let S be a planar subdivision with n edges. In O(n log n)
expected time one can construct a data structure that
uses O(n) expected storage, such that for any query
point q, the expected time for a point location query is
O(log n).
An overview of Lecture 7.1
Denitions: Convex set, Extreme point, Con-
vex Hull
Lower Bound
Point Pruning
Edge Pruning
Jarvis March
Graham's Scan
Summary
1
Denitions: Convex set,Extreme point
A set S E2 is convex i for every p1; p2 2
S, the segment p1p2 is completely within S.
A point p in a convex set S is said to be
extreme i there is no segment ab S with p
in its interior.
Problem Formulation
Given: A set P of n points in the plane.
Find: Smallest convex set containing P . It
is called the convex hull of P , and is de-
noted by CH(P).
Problem Formulation
Since P is nite, the boundary of CH(P) is
a simple polygon with a subset of points of P
as its extreme points(corners).
CH(P) is considered determined once its ex-
treme points, ordered around the boundary are
found.
Simplifying assumption: No pair of points
has the same x- or y-coordinate.
Equivalent Denitions ofConvex Hull
A convex combination of points p1 = (x1; y1);
p2 = (x2; y2); : : : ; pn = (xn; yn) is a point q =
1(x1; y1) + 2(x2; y2) + : : : + n(xn; yn) with
i 0 andP
n
i=1i = 1 .
In other words,
q =P
n
i=1ipi with i 0 and
Pn
i=1i = 1 .
Example: Convex combination of two points
p and q.
qp
(1-t) q+tp t > 0
Equivalent Denitions ofConvex Hull
Let P be a set of n points. A point q in
CH(P) is the convex combination of its ex-
treme points
q
P1P2
P3
P4
P5P6
P7
Equivalent Denitions ofConvex Hull
intersection of all convex sets containing P .
Equivalent Denitions ofConvex Hulls
intersection of all half-planes containing P .
+ 2 = byaxa1
+ 2 byaxa1 >_
+ 2 byaxa1 <_
Lower Bound
Sorting of real numbers can be transformed
in linear time into the convex hull problem.
Transformation: xi ! (xi; x2i)
x
x4 x5 x1 x7x3 x2 x6
y= x2
Lower Bound
Enumerating the extreme points around the
convex hull is equivalent to sorting the points
x1; x2; x3; x4; x5; x6.
x
x 4 x 5x 1 x 7x 3x 2 x 6
y =x2
1 0
Sor t i n gr e qu i r e s(n l o g n) t ime .Hen c e ,Con -
v e x hu l lpr o b l emmus tha v et h e s amel owe r
b ound .
Left and Right Turns
A sequence fp1; p2; p3g of points makes a
right turn at p2 i p3 is to the right or on the
line through p1 and p2( when looking from p1towards p2).
Otherwise fp1; p2; p3g makes a left turn
at p2
P2
P1 = (x1, y1)
= ( x2, y2)
P3 = (x3, y3)
Left and Right Turns
Consider p1p2p3 . The double of its area
(disregarding the sign) is
x1 y1 1
x2 y2 1
x3 y3 1
P2
P1 = (x1, y1)
= ( x2, y2)
P4 = (x4,y4)
P3 = (x3, y3)
The sign is + i fp1; p2; p3g appears
in the counterclockwise order on p1p2p3 .
Hence, fp1; p2; p3g turns left at p2.
Point Pruning
A point p 2 P is not extreme in CH(P) i
9fpi; pj; pkg 2 P fpg : p 2pipjpk
Finding all Extreme Points
P
PP
PP
PP
P
P
i
P
P
j
k
jk
i
P
k i
j
p 2 pipjpk can be veried in O(1) time;
fpi; pj; pg , fpj; pk; pg and fpk; pi; pg are
all left turns if we traverse pipjpk in the
anticlockwise direction.
If p 2pipjpkthen
eliminate p
Algorithm-Point Pruning
Algorithm: For each triangle, we test in O(n)
time whether all the remaining points are inside
or outside the triangle.
In the worst-case, there are O(n3) triangles
to consider.
Overall complexity: O(n4)
Improved Point Pruning
Pl
Pr
Can be improved to O(n2) by xing pi and
pj to the leftmost point pl and rightmost
point pr. Both pl and pr are extreme
points and can be found in O(n) time.
Sorting of Extreme Points
It remains to sort the extreme points.
Sorting of Extreme Points
Method1
P
q
Hq
Hq: half-line rooted at a point q in the
interior of a convex set S.
Hq intersects the boundary of S in exactly
one place(for all possible directions).
Sorting of Extreme Points
Sort extreme points of P in increasing or-
der of their polar angles around a point qknown to be in the interior of CH(P) . Re-
quires O(nlogn) time.
P
q
H q
θθ
12
Interior point: centroid of the extreme points:
(qx; qy) = (
nX
i=1
xi=n;nX
i=1
yi=n)
where pi = (xi; yi): Requires O(n) time.
Sorting of Extreme Points
Method2
Draw a line L through pl and pr. Partition the remaining extreme points into
two groups:
A: extreme points above L.
B: extreme points below L.
A
B
L p
Pl
r
Sort A by decreasing x-coordinate. Sort B by increasing x-coordinate. All this can be done in O(nlogn) time.
Edge Pruning
General idea: Identify boundary edges rather
than extreme points.
A segment between two points of P is a
boundary edge i all remaining points of
P are on one side of the line through the
segment.
L1
L2
Edge Pruning
Algorithm: For each pair of P -points pi andpj, check in O(n) time if all the remaining
points of P are on the same side of the line
through pi and pj. Number of pairs is O(n2). All boundary edges
can be identied in O(n3) time.
L
L
1
2
End points of boundary edges are extreme
points. They need to be sorted. This can be
done in O(nlogn) time.
Jarvis's March(1973)
Can we improve the O(n3) edge pruning al-
gorithm?
L1
2L
P1
P2 P3
Observation
When a boundary edge pipj has been iden-
tied there must exist another boundary
edge with pj as one of its endpoints.
Jarvis's March
General idea: use one extreme edge as an
anchor for nding the next.
P
P
P
P
1
2
3
45P
The algorithm output the extreme points in
the order in which they occur around the hull
boundary.
Jarvis's march is also known as
gift wrapping method
Jarvis's March - Continued
Find the point p1 with lowest y-coordinate.
Find the point p2 such that its polar angle
with p1 as origion is smallest possible.
Find the point p3 such that its polar angle
with p2 as origion is smallest possible.
P
P
P
P
1
2
3
45P
Continue until the point of P with highest
y-coordinate has been identied.
" Turn around " and repeat.
Time Complexity of Jarvis'sMarch
To nd the points p1 and p2 takes O(n)
time.
P
P
P
P
1
2
3
45P
To nd each next hull vertex pi, we spend
O(n) time.
Time Complexity of Jarvis'sMarch
P
P
P
P
1
2
3
45P
If the number of extreme points( and bound-
ary edges) is k, then the time complexity
of Jarvis's march is O(nk).
If the number of extreme points k is small
compared with O(n), i.e., if k is bounded
by a constant, then Jarvis's March runs in
linear time.
Jarvis's march can be generalized to higher
dimensions.
How to improve Jarvis'sAlgorithm
In Jarvis's algorithm, each time
Based on the recent hull vertex p and the
most recent hull edge e, we nd the next
hull vertex by choosing the point p0 which
makes the angle between e and pp0 largest.
P
P
1
e
P’
How to improve Jarvis'sAlgorithm
P
P
1
e
P’
A possible improvment is that we presort
the points in some way so that once we
nd a point is not qualied for the next hull
vertex, then we exclude the point forever.
Algorithm-Graham's Scan(1972)
Determine an interior point q of CH(P).
Sort the points of P around q by non-decreasingpolar angles. If several points of P have the
same polar angle, sort by increasing distance
from q.
q
123
4
5
67
8
9
10
11 12
1314
15
S
Let S be the polygon through all the points
of P so that the appear in the sorted order in
the counterclockwise traversal of P .
Graham's Scan
Identify the leftmost point of P . Denote it
by p( p be the predecessor of p and p+ be
the successor of p on P).
P
P_
P+
If makes then p := p+
else remove p and set p = p
p- , p , p+
p
_
a left turn at
P
P_
P+
P
P_
P+
P
P+
P-
Graham’s Scan
Graham's Scan-Continued
It is not necessary to determine q.
1
2
3
4
5
6
7
8
910
11
12
13
14
Graham's Scan-Correctness andComplexity
Graham's scan will never go backward be-
hind the initial leftmost point of P .
When arriving at some point p, all points
between the initial point and p are left turns
on the polygon.
p
Graham's Scan-Correctness andComplexity-Continued
After arriving the initial leftmost point (by
forward step), P has left turns only ( it is
convex).
Number of backward steps is O(n): during
each backward step one point is removed
from P .
Number of forward steps is also O(n): Since
there are only O(n) points in the set.
Both forward and backward steps require
O(1) time.
Graham's Scan-Correctness andComplexity-Continued
p
Graham's scan requires O(n) time after the
points of P have been sorted in O(nlogn)
time.
Graham's scan can be regarded as a modi-
cation of point pruning.
Convex Hulls in the Plane -Summary
Point pruning ........ O(n4); O(n2)
Edge Pruning ........ O(n3)
Jarvis's march ........ O(nh)
Graham's scan ........ (nlogn)
"! #%$&')("*+-,. /
0 + (1 23+-45476
89: ;< =?>@; AB#C>@DE+@F,
=?>@;-#CG IHJ); KL>@(F,.G >J*M=<4'NO#P,Q*RS>@T UV4IT-#P,W7*X<G
=?>@;-#CG IHJ); KL>@(F,.G >J*M=<4YAB#C>)@"Z X<+-454UV4IT-#\[,W7*X<G
N]+<G G =^,`_
a
:@> =?> =^,%7* , =^,`_ 6M"* #%$ # S>J* 6 #%$ *X@ ! #"%$ &('*)+) ,.- /021 #%$ I6 *X@ 6G =<454I 6 * (J#C>)@"Z 6M"* (J#C>J*M=%S>S>@T 3
4567
89:; <=<>=>
?@
ABCDEF
GH
IJ K=KL=L
MN OPQR
ST
U X@ 6M"* #%$V"Z)* ,.G # S>J* 6 I6 *X@ 6G =<454I 6 *6+V 6M"* #%$ X^= S>@T *X@ , # F,Q* _ *X^=)* ,.- /021W ,.- /0X1 =?>@; I6 ,.)(^I6MF4 _ *X@ @F,Q*R () 6#%$
U! # 6 * 6 =^,. ,.)DE+ ,.); * # >@; *X@ (J#C>)@"Z X<+-454#%$ = >7* 6M"*
/ 1 KQ;<>J*R:$ _ *X@ "Z)* ,.G # S>J* 6 3
/(1 ,.;<F,9*X@ 6M # S>J* 6 6 # *X^=)* *X@_ $ #P, G =(J#C>)@"Z #E4 _@T-#C> 3
!!""
#$ %&'(
)*
K $ SG , #%@G >J* 6 =^,. * # G = ;< S> *X@ =<4IT-#P,W7*X<G *X@G G + 6 * (J#CG
^7*X@F, _ F4 SG S>^=)*RS>@T ,.);E+<>@;P=?>J* (J#CG +J*M= [*R #C> 6 / O# S>J* , +<>S>@T ;<T< , +<>S>@T ^=^,`I6 6G =^,.(X =?>@; , =?X^=?G 6 6M( =?> 1 3
#P, _ *M=?1@S>@T =9; BF,.>J* *X@J#P,."*R ( =<4= , =@# (X 3
89: ;< =?>@; AB#C>@DE+@F, =<4IT-#P,W7*X<G 6
'+ &('*)+)
" " &('*)+)
"!$# &%'+"! ( V"# " *)+ ) ! #"%$ '*)+)
Q
0 + (1"6 #P,Q* :@> =?> =^, , =_ #%$ ><+<G -F, 6 =^,Q*R7*R #C> 7*S>J* # = 4I$.*9=?>@; ,W TEXJ* 6+V\=^, ,`_ P6+@(X*X^=)* = (X ><+<G -F,3S> *X@ , 6 *I6 4I 6 6 *X^=?> = (X><+<G -F,Y#%$ *X@ 6M)(J#C>@; 3 ,.)(+-, 6 :@F4 _ ( =<454?*X@ = %#%@ 6+V^, #C+J*RS>@ 3 G F,.T< *X@ * ! # 6 #P,Q* ); 6+V<4 I6 * 6 3
89 80 79 71 68 65 59 27 5
0 + (1\X<+-454 I6 *X@ =?>^=<4:#?TE+@ #%$ *X@ 0 + (1"6 #P,Q*=<4IT-#P,W7*X<G 3
>@F, =<4 ;< = ; I6M( =^,.; *X@ # S>J* 6*X^=)* =^,. > #*
#C> *X@ (J#C>)@"Z X<+-454C= 6DE+ (1^4 _ = 6 #-6 6 <4I 3
!"#$#%
&'() *+ ,- ./ 01 23 4$45 6$67$7
89 :; <= >?@$@A$AB$BC$C DE
FG HIJK
LM NO PQRS TUVW XYZ[ \]
^_`abc
def$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$ff$f$f$f$f$f$f$f$f$f$f$f
g$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$gg$g$g$g$g$g$g$g$g$g$g$g
h$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$hh$h$h$h$h$h$h$h$h$h$h
i$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$ii$i$i$i$i$i$i$i$i$i$i
j$j$j$j$jj$j$j$j$jj$j$j$j$jj$j$j$j$jj$j$j$j$jj$j$j$j$jj$j$j$j$jj$j$j$j$jj$j$j$j$jj$j$j$j$j
k$k$k$k$kk$k$k$k$kk$k$k$k$kk$k$k$k$kk$k$k$k$kk$k$k$k$kk$k$k$k$kk$k$k$k$kk$k$k$k$kk$k$k$k$k
l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$ll$l$l$l$l$l$l$l$l$l$l$l$l$l$l$ll$l$l$l$l$l$l$l$l$l$l$l$l$l$l$ll$l$l$l$l$l$l$l$l$l$l$l$l$l$l$ll$l$l$l$l$l$l$l$l$l$l$l$l$l$l$ll$l$l$l$l$l$l$l$l$l$l$l$l$l$l$lm$m$m$m$m$m$m$m$m$m$m$m$m$m$m$mm$m$m$m$m$m$m$m$m$m$m$m$m$m$m$mm$m$m$m$m$m$m$m$m$m$m$m$m$m$m$mm$m$m$m$m$m$m$m$m$m$m$m$m$m$m$mm$m$m$m$m$m$m$m$m$m$m$m$m$m$m$mm$m$m$m$m$m$m$m$m$m$m$m$m$m$m$m
QuickHull’s Initial quadrilateral
, 6 * (J#CG +J* *X@ # S>J* 6 ! 7*X G =)Z?G SG +<G=?>@; G S>SG +<G [=?>@; [ (J# #P,.; S>^=)* 6 3 U X@ # S>J* 6 4 _S>@T ! 7*XS> *X@ DE+^= ; ,W 4 =)* F, =<4 ( =?> - F4 SG =)* ); S> *RSG 3 A34 = 6 6 :$ _ *X@ ,.G =%S>S>@T # S>J* 6 S>J* # $ #C+-, (J#P, >@F,* ,W =?>@T 4I 6 3
! "# $% &&' (() **+
+
,- ./ 00122345678899
:; <=>?
@A BC DDEEFFG HHIIJJK LLMMNNOO
PQ
RSTUVW
XYZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
____________________________________
`````````````````````````````````````````````````````````````````````````````````````aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Xmin
Xmax
Ymin
Ymax
'+ '*)+) ) # ) "! '"
!"
#$
%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%%&%&%&%&%&%&%&%&%&%&%&%
'&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&''&'&'&'&'&'&'&'&'&'&'&'
()*+ ,-./ 012345 67 89
:;<=
>>?? @A
BC
D&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&DD&D&D&D&D&D&D&D&D&D&D&D
E&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&EE&E&E&E&E&E&E&E&E&E&E&E
FG
HI
JJKK LLMM N&NN&NO&OO&OP&PP&PQ&QQ&Q R&RR&RS&SS&ST&TT&TU&UU&UVVWWXXYYp
l
pr
A
B
S>@; *X@ 4I$.*G #-6 *=?>@; *X@ ,W TEXJ*G #-6 * # S>J* 6Z\[ =?>@; Z^] 3
=^,Q*R7*R #C>*X@ ,.G =%S>S>@T # S>J* 6 S>J* # * ! # 6+V [6M"* 6 _ =?>@; ` ;< >@; S>@T #C> ! X@"*X@F,V*X@_=^,. = %#%@ #P, -F4:# ! *X@ 4 S>@ a *X-, #C+@TEX Z\[=?>@; Z^] 3
AB#C> 6 ;<F, _ 3YK $ _ W *X@> Z [ Z ] I6 = %#C+<>@;^[
=^,`_ );<T< 3
A
B
= ϕ
K $ _ W *X@> ;<"* F, G S>@ = # S>J* Z 6+@(X
*X^=)* Z\[ Z^] Z I6 4 =^,.T< 6 * #-6 6 <4I 3 K $ *X@F,.=^,. 6M@F, =<4 ( =?>@; ;P=)* 6 $ #P, Z 6MF4I)("* *X@4I$.*G #-6 * #C>@ 3
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
"!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!""!"!"!"!"!"!"!"!"!"!"
#$%& '()* +,-./0 12 34
5678
9: ;<
=>
?!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!??!?!?!?!?!?!?!?!?!?!?
@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@@!@!@!@!@!@!@!@!@!@!@
ABCD EFGH IJKLMN OP QR
STUV
WWXX YZ
[\
]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]]!]!]!]!]!]!]!]!]!]!]
^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^^!^!^!^!^!^!^!^!^!^!^
_`ab cdef ghijkl mn op
qrst
uuvv wx
yz
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!||!|!|!|!|!|!|!|!|!|!|
!~!~
!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!
pl
pr
pl
prphA
"! #%$'&()#+* # ,.-/0!1&2-.3 465 798;: <
=>?@ ABCD EFGHIJ KL MN
OPQR
ST UV
WX
YZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZYYZYZYZYZYZYZYZYZYZYZYZY
[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[Z[
\]^_ `abc defghi jk lm
nopq
rs tu
vw
xZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZxxZxZxZxZxZxZxZxZxZxZxZx
yZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZyyZyZyZyZyZyZyZyZyZyZyZy
zZzZ
|~
ZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZ
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
pl
prph
l
( ! # & # ,.-/0!1& -.3 8 0! <
+ # & # ()#+* .0!+0! ,.-/0!1& 0! 0!1& -& - #%& "! !" ( # 0! & #%$ 0! # &( -&' "! 6#($)$ &( -&' "! "! ()# ,# '& 3 -( "! <
* # ,# '& 3 -( + <
,-./ 012345465678 9:
;<=>?@
AB CDEF
GH
I5IJ5J KLMNOP QR
Al
Ar
p
pr
ph
l
, ,# ( $)$ 7 8 : 3 8 ! " $# & #+! ()#%&( ! 7 : <#($ #
% ! & ( & # &%7 ')( ( : *7 3 ( & # & & - $ 0! # : % ! ,.-/0!1& -.3 8 - ! -( & - & #$#3)& -.3 7 + -, : % ! ,.-/0!1& -.3 8 - ! -( & - & #
('1& -.3 7 +-, :7 * #/. ( #($ ! . $)$ , ,# ( $)$ 7 0 -, :2 "! , ,# ( $)$ 7 -, ::()#%&( ! , ,# ( $)$ 7 0 -, : 1
, ,# ( $)$ 7 -, :#+!
#+! <
##%$'&( .%& - !23 ( - * 8 -.3 7 "! + :;0! .($ 0! & # #($ 0* 0! '& - ! -.3 ,.-/0!1& 0!1& # ( ! $& - & # &( "! $# . ( ( # -&1& 0! & 0* #"< 3;& # 1# -.3 "! + '& * - & #' $ "!&+ -'$ . '& # . $# #($ -.3 ()#/. ( - !.1- * , $#%$. &! < -( & . # .1- * , $#%$. &! % 7 : , ( & & - !0! . "! # # ( ! ! # #+! <
!"# $%&'()(*)*+, -.
/01234
56 789:
;<
=)=>)> ?@ABCD EF
Al
Ar
p
pr
ph
l
$ -( & * < . "! # + # 6# #+! # ( $ '& - ! -.3 * # ( # -( &
!"#$
%&'()*+,-.
/ / / / / / / / / / // / / / / / / / / / // / / / / / / / / / // / / / / / / / / / // / / / / / / / / / /
0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 12 2 2 2 2 2 2 2 2 2
Upper tangent
lower tangent
P1P2
!
"#$%&'()*+
, , , , , , , , , , ,, , , , , , , , , , ,, , , , , , , , , , ,, , , , , , , , , , ,- - - - - - - - - - -- - - - - - - - - - -- - - - - - - - - - -- - - - - - - - - - -
. . . . . . . . . ./ / / / / / / / / /
Upper tangent
lower tangent
P1P2
-'$ # ()#/.%&#$ ! 3 0 81032 4 < 5 7698;: <
( & & - ! 8 0!1& - & - < #' $/1# < #%& 8>= "! 8 <5 # ()# 8>= .1- ! & -.3 ,.-/0!1& 5 && # $ - 6# & ? .1-/-( 0! '& # "! 8 .1- ! & -.3& # ,.-/0!1& & & # +' # & ? .1-/-( 0! '& # <
a
b
#%& # ( * 0! # 7 ()#/. ( #($ ! : 465 798>=: ! 5 "!465 798 : ! 5 <
# ( # & # & - -'$ 1& - ! & - -''& .0! 465 798;: ! .1- * , 1& 0! & # , ,# ( "! $ - 6# ( & "! #+!1& 3 -( 5 "! 5 "! . ( 0! $)$& # ,.-/0!1& $ !+0! #%&6#'#+! & # # & - & "! #+!1& <
! "#
$$%%
&'
()**********++++++++++
,,,---
........./////////
000000001111111122222222333333444444444555555555
666666777777888888888888888888888888888888888888888888888888888888888888888888888888888888
999999999999999999999999999999999999999999999999999999999999999999999999999999
::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;<<<<<<======
>>>>>>>>>>>>>>>>>>>>>????????????????????
@@@@@@@@@@@@@@@@AAAAAAAAAAAAAAAA
BBBBBB
CCCCCC
DDDDDDDDDDEEEEEEEEEE
FFFFFFFFFGGGGGGGGG
HHHHHHHHHHHHIIIIIIIIIIII
JJJJJJJJJJKKKKKKKKKK
LLLLLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMM
NNNNNN
OOOOOO
PPPPPPPPPPPPPPPPPP
QQQQQQQQQQQQ
RRRRRRRRRRRRRRRSSSSSSSSSSSSSSSTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUVVVVVVVVVVVVVVVVVVVVWWWWWWWWWWWWWWWWWWWW
XXXXXXXXXXXXXXXXXXXXXXXXXXYYYYYYYYYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZZZZZZZZZZZZ[[[[[[[[[[[[[[[[[[[[[[[[[[[[
\\\\\\
]]]]]]
^^^^^^^^________
`````````aaaaaaaaa
bbbbbbbbbcccccccccdde
effffgggghhhhhhiiiiii
a
b
j kmlonqprntsvuwnyxz | p~ z pz np p nlp =sl ny pz uyzp p nlp znlp | sl sl zvl nl ¢¡¤£ prn z¥¦
!
"#
$%
&'()
*+ ,-
..//
01
23
4444444444
5555555555
666777
888888888999999999::::::::;;;;;;;;<<<<
<<<<======
>>>>>>>>>?????????
@@@@@@AAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
DDDDDDDDDDDDDDDDDDDDDDDD
EEEEEEEEEEEEEEEEEEEE
FFFFFFGGGGGG
HHHHHHHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIII
JJJJJJJJJJJJJJJJ
KKKKKKKKKKKKKKKK
LLLLLL
MMMMMM
NNNNNNNNNN
OOOOOOOOOO
PPPPPPPPPQQQQQQQQQ
RRRRRRRRRRRRSSSSSSSSSSSS
TTTTTTTTTTUUUUUUUUUU
VVVVVVVVVVVVVVVVVVVVVVVVV
WWWWWWWWWWWWWWWWWWWWWWWWW
XXXXXX
YYYYYY
ZZZZZZZZZZZZZZZZZZ
[[[[[[[[[[[[
\\\\\\\\\\\\\\\]]]]]]]]]]]]]]]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
____________________________________
````````````````````aaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccc
ddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeee
ffffff
gggggg
hhhhhhhh
iiiiiiii
jjjjjjjjjkkkkkkkkk
lllllllllmmmmmmmmm
nnoo
ppppqqqqrrrrrrssssss
a
b
j t vu¤z p slvzolxw ny s l nqprn l p s p z p z p z u svu uyw zw sl nzolp s prn l p z p pz pu |z ~prn z sl lz n nl |z prn z l pz vu u ¦
CH(P2 )
!"##$$
%%%%%%%%%%
&&&&&&&&&&
'''(((
)))))))))*********++++++++,,,,,,,,----
----......
/////////000000000
111111222222
333333333333333333333333333333333333333333333333333333333333333333333333333333
444444444444444444444444444444444444444444444444444444444444444444444444444444
555555555555555555555555
66666666666666666666
777777888888
999999999999999999999::::::::::::::::::::
;;;;;;
<<<<<<
==========
>>>>>>>>>>
?????????@@@@@@@@@
AAAAAAAAAAAABBBBBBBBBBBB
CCCCCC
DDDDDD
EEEEEEEEEEEEEEEEEE
FFFFFFFFFFFF
GGGGGGGGGGGGGGGHHHHHHHHHHHHHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
KKKKKK
LLLLLL
MMMMMMMMMM
NNNNNNNNNN
OOOOOOOOOPPPPPPPPP
QQQQQQQQQRRRRRRRRR
SSTT
UUUUVVVVWWWWWWXXXXXX
a
b
HC (P1)
CH(P2 )
a b is not a tangent to
!"
#$
%%%%%%%%%%
&&&&&&&&&&
''''
((((
)))))))))*********++++++++++++,,,,,,,,,,,,----
----......
/////////000000000
111111222222
333333333333444444444444
555555
666666
777777777777
888888888888
999999999999
::::::::::::
;;;;;;;;;;;;<<<<<<<<<<<<
=====>>>>>
?????????????????????????
@@@@@@@@@@@@@@@@@@@@@@@@@
AAAAAA
BBBBBB
CCCCCCCCCCCCCCCCCC
DDDDDDDDDDDD
EEEEEEEEEEEEEEEFFFFFFFFFFFFFFFGGGGGGGGG
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
IIIIIIIIIIIIIIIIIIIIJJJJJJJJJJJJJJJJJJJJ
KKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLLLLLLLLLLLLLLLL
MMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNNNNNNNNNNNNNNN
OOOOO
PPPPP
QQQQQQQQQQ
RRRRRRRRRR
SSSSSSSSSTTTTTTTTT
UUUUUUUUUVVVVVVVVV
WWWXXX
YYYYZZZZ
[[[[[[\\\\\\
a
b
ab is not a tangent to CH(P )
CH(P1)
CH(P2)
1
t vu¤z ~ slvzolp ¥ ¥ np p |z p z 4 ¥ uyzp p |z p z ¥ ny lop u vu¤z p slvzolp op
sl s ¥ ny lop s u vu¤z p slvzolpp~
|z u u ny z¥ ¥ ny lop s u vu¤z p slvzolpp~
|z vlp z u u ny z¥
z p l ¦ z n p slp ponl ny zs o |z p z l zs ovu usl z |ony nqp z s p p l z zw pz zs o"!sl zol z pz vlvlonl prn z ny $# ¥ u z z# 0 0 0 0 2 0 = 0 0 = 0 ¦
j ¢¡¤£ £ ¡ !! ¢¡"#! £%$ ¢¡¤£ ¡ & !
j k p ny u¤z u u ~ lvu l p s p o s z o n |z vl ~prn l ny ¡ (' ¡
j z p slvzolpsl z p z nl ¥ prn z¦
! " #%$&" ')(*",+.-0/.132#4" +5'06768",9 :;'</49>=@? 18AB",9 1C/4+:D"FE? "./B(&'06G+B=@/%$H(F:I#4+J(K1L=@/ MN=O: 90"P$F13Q/.1C/4Q ' :;'</RE9>=@? 18AB",9 '068Q>=O:S1T(-0? MN=O:U+B=@/,V4"JW -0#>676YX
Z -.18$ (*",+.-0/.132#4" 18$ V4":\[ #%$&"RM]#>6UMN=O: 90"P$F13Q/.1C/4Q:;'</49>=@? 18AB",9 Q0"B=@? "J(F:S13+ '068Q>=O:S1T(-0? $%X
! " #%$&" ' :;'</49>=@? ^>":I? #B(&',(K1L=@/ =_M`(-4" 1C/>^<#B('</49 (-4" (-4" :D"P$R#>6a(K1C/4Q '068Q>=O:S1T(-0? 18$ ' bc'5$d ",QO'5$ '068Q>=O:S1T(-0? X e( '06af'[%$ ^g:h=i9#4+,"P$ (-4"+B=O::D",+J( :D"P$R#>6a(BX
! "fj1k676%(F:\[l(m= "P$H(K1C? ',(*"(-4""JW0^>",+J(*",9 :I#0/0/.1C/4Q(K1C? " =_MU(-4" '068Q>=O:S1T(-0? X
n
P & g
e />^<#B( $&"J(j=_M #0/%$ =O: (*",9 /0#0? >": $%X
#B(F^<#B( $ =O: (*",9 $&"J(l=_MU(-4"P$&" /0#0? >": $%X
! " $ =O: ( (-4" /0#0? >": $1C/4+:D".? "./B(&'0676 [PX(U"RV4":\[$H(*"^ ' :;'</49>=@? 1C/>^<#B( 18$ +.-5=>$&"./ '</49 ' 9090",9(m= (-4" $ =O: (*",9 $&"J(BX
"./4+," '%MD(*": $H(*"^ 1 if " -g'%V4" ' $ =O: (*",9 $&"J( =_M /0#0? >": $'</49 '</ #0/%$ =O: (*",9 $&"J(`=_M /0#0?jE>": $%X
=O:' 909 1C/4Q (-4" /4"JW,( 1C/>^<#B(" +g13"./B(F6 [f " #%$&"(-4" 1390"5' =_M ' +B=@/ 13+J( 6 18$H( X
P & g
conflict lists
points already sorted
MD(*": (-4" E (-$H(*"^ <+B=>$F1390": (-4" #0/%$ =O: (*",9^_=c1C/B(H$%X
' +.- =_M (-4"P$&" #0/%$ =O: (*",9 ^_=c1C/B(H$ fj1k676 >" 1C/ =@/4"=_M (-4" 1C/B(*":\Vg'06T$ 90" /4",9 [j(-4" $ =O: (*",9^_=c1C/B(H$%X
! 1T(-G"5' +.-l1C/B(*":\Vg'06 >"J(f ","./ (f = ' 9H' +,"./B( $ =O: (*",9^_=c1C/B(H$ f " K","^ ' 6 18$H( =_M '0676 (-4" #0/%$ =O: (*",9^_=c1C/B(H$ 1C/ (-g',( 1C/B(*":\Vg'06YX Z -.18$ 18$ +5'06768",9 '+B=@/ 13+J( 6 18$H( X
j j Ni
=@/%$F1390":(-4" : $H( ^_=c1C/B( (-g',( f " +.-5=c=>$&"M :h=@? (-4" #0/%$ =O: (*",9 ^_=c1C/B(H$%X
1C/B(F:h=i9#4+,"P$ (f = 1C/B(*":\Vg'06T$ '</49 MN=O:G'0676(-4" #0/%$ =O: (*",9 ^_=c1C/B(H$%X
! " +B=@? ^ 'g:D" "5' +.- #0/%$ =O: (*",9 ^_=c1C/B( fj1T(- '</49 K","^ ' ^_=c1C/B(*": "g1T(-4": (m= =O: (m= X
I1I2
p1
unsorted points
j j Ni
! " '06T$ = K","^ ' 6 18$H( =_M'0676_(-4" ^_=c1C/B(H$(-g',( 'g:D"1C/ '</49 1C/ XUZ -4"P$&" 'g:D" (-4")+B=@/ 13+J(6 18$H(H$%X
#>^0^_=>$&" f " :;'</49>=@? 6 [ +.-5=c=>$&" '5$(-4" /4"JW,(^_=c1C/B( (m= >" ' 9090",9 (m= (-4" $ =O: (*",9 6 18$H(BX
I1I2
p1
pk
j j Ni
I1I2
p1
pk
:h=@? (-4" ^_=c1C/B(*":$H(m=O:D",9 fj1T(- f " +5'</ 90"FE(*":I? 1C/4" 1C/ (K1C? " $R-5=@#>689 >" ' 9090",9(m= f)-.13+.- 1C/B(*":\Vg'06 =O: X
#>^0^_=>$&" Q>=i"P$ (m= X 18$ 9 1 V.1390",9 1C/B(m= (f =1C/B(*":\Vg'06T$ '</49 9#4" (m= X
j j Ni
I2p1
pk I3I4
unsorted points
! " -g'%V4" (m= +:D"5',(*" (f = /4"Jf +B=@/ 13+J( 6 18$H(H$MN=O: '</49 M :h=@? (-4" +B=@/ 13+J( 6 18$H(jMN=O: X
! "9>= /5=.(/4",",9 (m= 9>= '</,[B(-.1C/4Q fj1T(-(-4"+B=@/RE 13+J( 6 18$H(=_M X
j jj
! " ? '_1C/B(&'_1C/ ' ^_=c1C/B(*":MN=O: "5' +.- /0#0? >":[R"J((m= >" 1C/%$&": (*",9 1C/ (-4" $ =O: (*",9 6 18$H(BX
MD(*": (-4" E (-$H(*"^ 4(-4"^_=c1C/B(*":iMN=O: "5' +.- #0/.1C/RE$&": (*",9 /0#0? >": $J^>",+g1 @"P$jf)-.13+.- =_M (-4"
1C/B(*":\Vg'06T$ 1C/ (-4" $ =O: (*",9 6 18$H( 1T( f =@#>689 >" 1C/RE$&": (*",9 1C/B(m= 1 MG1T( f ":D" /4"JW,((m= >" 1C/%$&": (*",9 X
Z -4" ^_=c1C/B(*": $ 'g:D" _139 1k:D",+J(K1L=@/g'06 $ = (-g',(lQ 1 V4"./'</ 1C/B(*":\Vg'06Of " +5'</ 90"J(*":I? 1C/4" (-4" /0#0? >": $f)-5=>$&" ^_=c1C/B(*": $ ^_=c1C/B( (m= 1T(BX
l
f)-g',( 18$ (-4" f =O: :D",2#.1k:D",9 (m= ? '_1C/B(&'_1C/ (-4"P$&"^_=c1C/B(*": $%X #>^0^_=>$&"f " 1C/%$&": ( ' /0#0? >": f)-5=>$&" ^_=c1C/B(*":^_=c1C/B(H$j(m= 1C/B(*":\Vg'06 X / 1C/%$&": (K1C/4Q if " -g'%V4" (->:D"," (&'5$J$%X /49 '0676 /0#0? >": $ f)-5=>$&" ^_=c1C/B(*": $ ^_=c1C/B( (m= X #>^>9O',(*" (-4" ^_=c1C/B(*": $=_M '0676 /0#0? >": $ f)-5=>$&"^_=c1C/B(*": $ ^_=c1C/B( (m= X 90"68"J(*" (-4" ^_=c1C/B(*": M :h=@? (m= X
p1
unsorted pointsx
I
4 l N
Z -4" 1C? ^_=O: (&'</B((&'5$ 18$ X
Z -4"f =O: 9>=@/4" 1C/ (-.18$)#>^>9O',(*" $H(*"^ 18$)^g:h=^_=O: E(K1L=@/g'06 (m= (-4" /0#0? >": =_M ^_=c1C/B(*": $ ^_=c1C/B(K1C/4Q (m= X
p1
unsorted pointsx
I
! -4"./ f " -g'%V4" ' 9090",9 '0676 (-4" 1C/>^<#B(H$ f "-g'%V4" (-4" $ =O: (*",9 $&"J(BX
! " ' 909 ' /4"Jf :;'</49>=@? ^_=c1C/B( ',( "5' +.- $H(*"^1C/ (K1C? " <#B( f " 9>= ' 6 =.( =_M`f =O: MN=O:+.-g'</4Q 1C/4Q (-4" +B=@/ 13+J( 6 18$H(H$%X
#>^0^_=>$&" f " -g'%V4" '067:D"5' 9.[ ' 9090",9 ^_=c1C/B(H$j'</49f " 'g:D" (F:\[.1C/4Q (m= ' 909 (-4" E (- ^_=c1C/B(BX
Z -4" E (-)$H(*"^ +B=@/%$F18$H(H$=_M +.-5=c=>$F1C/4Q =_M =@/4"(-4" [R"J( #0/%$ =O: (*",9 /0#0? >": $ #0/.1 MN=O:I? "6 [',():;'</49>=@? '</49 1C/%$&": (K1C/4Q 1T()1C/B(m= (-4" $ =O: (*",96 18$H(BX
! " -g'%V4" (m= "P$H(K1C? ',(*" f)-g',( 18$ (-4" "JW0^>",+J(*",9+B=>$H(MN=O: (-4" ' 909 1T(K1L=@/ =_M (-4" E (- ^_=c1C/B(BX
! " #%$&" ' (*",+.-0/.132#4" +5'06768",9 ' + Ff'g:D9 '</g'06 [%$F18$(m= "P$H(K1C? ',(*" (-.18$%X
Z -.18$ -g'5$ '067:D"5' 9.[ >","./ #%$&",9 1C/ (-4" +B=@#>: $&" "P$F13Q/ '</49 G/g'06 [%$F18$ =_M 68Q>=O:S1T(-0? $ b 1C/(f =)9 1C? "./%$F1L=@/%$U'</49+B=@/%$H(F:I#4+J(K1C/4Ql(-4"(F:;'0^>"FEAP=c139O'06@90",+B=@? ^_=>$F1T(K1L=@/ MN=O:' $&"J()=_Ml6 1C/4" $&",QgE? "./B(H$ RX
GJ
! -4"./ f " -g'%V4" ' $&"J( =_Mj= ",+J(H$ 1T( 18$ "5'5$F13":(m= "P$H(K1C? ',(*" (-4" "JW0^>",+J(*",9 +B=>$H(j=_M +.-5=c=>$F1C/4Q=@/4" = ",+J(M :h=@? (-4" $&"J(BX
U#B( 1T( 18$ 9 1 +.#>6a( (m= "P$H(K1C? ',(*" (-4" +B=>$H( =_M' 909 1C/4Q ' /4"Jf = ",+J( f)-.13+.- 18$ /5=.( 1C/ (-4"$&"J(BX
GJ
I2I1 I3 I i
e / =@#>: +5'5$&" 1 MUf " f'</B((m= "P$H(K1C? ',(*" (-4" +B=>$H(=_M' 909 1C/4Q (-4" E (- 1C/>^<#B( (m= (-4" $ =O: (*",9$&"J(l=_M ^_=c1C/B(H$%X
U#B(U(-4" E (- 1C/>^<#B(18$j/5=.( 1C/(-4"j$ =O: (*",9 $&"J(=_M ^_=c1C/B(H$%X
= f " Q>= ' + Ff'g:D9_$
GJ
! " "P$H(K1C? ',(*" (-4" +B=>$H( =_M 90"68"J(K1C/4Q ' :;'</49>=@?1C/>^<#B(lM :h=@? ' $ =O: (*",9 $&"J(j=_M 1C/>^<#B(H$%X
Z -4":D" 'g:D" #0/%$ =O: (*",9 ^_=c1C/B(H$'</49 1C/B(*":\Vg'06T$ >"RMN=O:D" (-4" 90"68"J(K1L=@/ X
I2I1 I3 I i + 1
GJ
".? ".? >":>(-g',( (-4"l/0#0? >": $f ":D" ' 9090",9 :;'</RE9>=@? 6 [ 1C/ (-4" =O:S13Q 1C/g'06@'068Q>=O:S1T(-0? X
= 1C/ (-4" ' + Ff'g:D9 '</g'06 [%$F18$ f " +5'</ '5$*$R#0? "(-g',( "5' +.- =_M(-4" /0#0? >": $ 18$ ",2#g'0676 [6 1 K"6 [ (m= >" 90"68"J(*",9 X
MD(*":G(-4" 90"68"J(K1L=@/ (-4":D" 'g:D" #0/%$ =O: (*",9^_=c1C/B(H$ $ =O: (*",9 ^_=c1C/B(H$ '</49 1C/B(*":\Vg'06T$%X
I2I1 I3 I i + 1
GJ
Z -4" "JW0^>",+J(*",9 /0#0? >": =_M#0/%$ =O: (*",9 ^_=c1C/B(H$ 1C/=@/4" 1C/B(*":\Vg'06018$ /0#0? >": =_M#0/%$ =O: (*",9 ^_=c1C/B(H$9 1 V.1390",9 [ /0#0? >": =_M 1C/B(*":\Vg'06T$%X Z -.18$ 18$
X
! " -g'%V4"(m= +.-g'</4Q0"(-4" ^_=c1C/B(*": $ MN=O: '0676 (-4"P$&"^_=c1C/B(H$ MN=O: #>^>9O',(K1C/4Q (-4" +B=@/ 13+J( 6 18$H( '%MD(*":(-4" 90"68"J(K1L=@/ =_M (-4" E (- ^_=c1C/B(BX
"./4+," (-.18$ 18$j(-4" f =O: 9>=@/4" MN=O: (-4" 90"68"J(K1L=@/=_M (-4" E (- ^_=c1C/B(BX
#0? ? 1C/4Q =_V4": '0676.(-4" $H(*"^5$ (-4" "JW0^>",+J(*",9 (m= E(&'060f =O: 18$
:h=@? 6 1C/4"5'g:S1T(I[ =_M "JW0^>",+J(&',(K1L=@/ i(-.18$ 18$
l6 =<Q
!
"$#&%('*) + , -/.0) 1 2 35467398:6<;<;<;<673>= ?A@ B %A?DCE#*)F-HG
I '*)J%('*) + K L. M*?N#PO.0Q LR'&STS5?A@)UL. B %A?DCE#*)F-HG
V .PW5CE#
X G YLZ?D?&-/. [(#P\ )UL&]^.P. %A?DCE#*)F- @_]`?Na )UL. CE#&%('*)[(#b M*?N#H-F)J]c'M0)d)UL. M*?AO.0Q LR'&STS egfhBji(k_l(mHn G
conv( S3 ) o
!
G ? )UL. @ ? STS ? CE#W @ ? ] B ) CEa . -F) .9%Z- +
,bRb [ ] [(#b&?Na S \ M LZ?D?&-/. # %A?DCE#*) )<? )UL. .0QAC -F) CE#WM*?N#PO.0Q LR'&STS [(#b '&%&b [P) . )UL. M*?N#PO.0Q LR'&STS G
CH(Si-1 )Incremental convex hull
CH(Si)
p po o
!
. L[HO. )<? -0%&.PMC @ \ +
? b&? . [>bRb [ ] [(#b&?Na S \ M LZ?&-/. # %A?DCE#*) M*? ]]^.PM0)JS \
L[P)[]^. )UL. M*?N# C M0) S C -F)F- CE# )UL C - MZ[Z-/.
? b&? . '&%&b [P) . )UL. M*?N# C M0) S C -F)F-
? ]M9]^.Z[P) CE#W )UL. M*?N# C M0) S C -F)F- +
. M LZ?D?&-/. [ %A?DCE#*) 3 CE#H-JC bR. egfhBji(k_l m n G
Y ?N#R#.PM0)d)UL. B %A?DCE#*)F- )<? 3 G
conv( S3 )
po
? ] [ %A?DCE#*) 3 C @ )UL. S CE#. 3<3 CE#*) .9] -/.PM0)F- .PbRWR. 4
k X n ; . .P.9% [ %A?DCE#*) .9] )<? 4 C )UL )UL. %A?DCE#*)3 G
k n ; . CE#M9S 'bR. 3 CE# )UL. M*?N# C M0)S C -F) ?A@ 4 G
? . -F)/[] ) C )UL )UL&]^.P. M*?N# C M0) S C -F)F-HG
CH(S2 )
pi
e
e
e1
2
3po
e1e2
e3
p0
e1conflict list for e3conflict list for
e2conflict list for
'&%R%A?&-/. . []^. [>bRb5CE#W [ #. %A?DCE#*) 3 )<? egfhBji(k_l n L C M L C - )UL. M*?N#PO.0Q LR'&STS C )UL %A?DCE#*)F-HG
p0
pk
em
p0
pkem
(ii)(i)
"$# k X n ) CEa . . MZ[(# bR.0) .9]ca CE#. )UL[P) 3 V . S ?N#WA- )<? )UL. M*?N# C M0) S C -F)?A@ .PbRWR. G
"$#)UL. ] -F) MZ[Z-/. 3 C - ?N# )UL.-h[(a .-JC bR. ?A@ [Z- 3 G CE#MP. 3 C -CE#H-JC bR. egfhBji(k_l n . ]^. .PM0)3 G
. []^. )J]7\ CE#W )<? M*?N#H-F)J]c'M0) egfhBji(k_l 4 n @_]`?NaegfhBji(k_l n [H@^) .9])UL. [>bRb5C ) C ?N# ?A@ 3 G K L.9]^. []^. )UL&]^.P. CE#bA- ?A@ .PbRWR.- [H@^) .9] 3 C -CE#H-/.9] ) .Pb +
k X n ; bRWR.- L C M L []^. 'R#[ .PM0) .Pb
k n ; bRWR.- L C M L - LZ?N'&S b V . bR.9S .0) .Pb
k n ; bRWR.- L C M L - LZ?N'&S b V . [>bRbR.Pb
em
pk
p0
unaffected
deletedadded
. .P.9% )UL. M*?N#PO.0Q LR'&STS9O.9] ) C MP.- CE# [ b&?N' V S \S CE# .Pb S C -F) - ? )UL[P) . MZ[(# a ?AO. CE# V ? )ULb5C ]^.PM0) C ?N#H- )UL&]`?N'W L )UL. S C -F)*G
?AO CE#W CE# V ? )UL b5C ]^.PM0) C ?N#H- . MZ[(# #b ) ?O.9] ) C MP.- i [(#b i - 'M L )UL[P) 3hi [(#b 3 i[]^. )/[(#WR. #*)F- )<? egfhBji(k_l n G K ? #. .PbRWR.-
[(#b []^. [>bRbR.Pb G
, STS )UL.%A?DCE#*)F-CE# V .0) .P. # i [(#b i CE# egfhBji(k_l n[]^. ]^. .PM0) .Pb G
i [(#b i []^. )UL. #.C W L V ? ] - ?A@ 3 CE#egfhBji(k_l 4 n G
em
pk
p0
vivjeq
eiej
. L[HO. )<? '&%&b [P) . )UL. M*?N# C M0) S C -F)F- ?A@ [RSTS)UL. .PbRWR.- . )UL&]`? [ [U\G
Y ?N#H-JC bR.9] [(# .PbRWR.S C . G, STS )UL. %A?DCE#*)F- L C M L
[]^. CE# )UL. M*?N# C M0) S C -F) ?A@ - LZ?N'&S b V . CE# M9S 'bR.Pb CE# )UL. M*?N# C M0) S C -F)?A@ G
[>M L - 'M L %A?DCE#*) C STS V . [>bRbR.Pb .C )UL.9] )<? )UL.M*?N# C M0)S C -F) ?A@ ? ] )<? )UL. M*?N# C M0)S C -F) ?A@ CE# k X n ) CEa .(G
, )a ?&-F)) ? .PbRWR.- []^. M9]^.Z[P) .Pb [P) .Z[>M L -F) .9%5G . #MP. )UL. )<? )/[RS ? ] b&?N#. @ ? ] M9]^.Z[P) CE#W ? ]bR.9S .0) CE#W .PbRWR.- C - B G , # .PbRWR. a [U\ . M9]^. [P) .Pb ?N#MP. [(#b bR.9S .0) .Pb ?N#MP.(G
K L. ? ] b&?N#. @ ? ] [>bRb5CE#W [ %A?DCE#*) 3 C - %]`?%A? ] ) C ?N#[RS )<?k X n ; )UL. ? ] b&?N#. @ ? ] [>bRb5CE#W )UL. %A?DCE#*) [(#bk n ; )UL. ? ] b&?N#. @ ? ] '&%&b [P) CE#W )UL. M*?N#
C M0) S C -F)F-
. C STS.-F) CEa [P) . )UL. .0QR%&.PM0) .Pb ? ] b&?N#.)UL&]`?N'W L V [>M []^b [(#[RS \H-JC -HG
0
em
pm
em+1
conv(Si+1)
"$# V [>M []^b [(#[RS \H-JC - M*?N#H-JC bR.9]5)UL. bR.9S .0) C ?N# ?A@[ %A?DCE#*) @_]`?Na egfhBji(k_l 4 n )<? WR.0) egfhBji(k_l n G
'&%R%A?&-/. . []^. bR.9S .0) CE#W [ %A?DCE#*) 3 G " @ .bR.9S .0) . 3 . L[HO. )<? bR.9S .0) . ) ? .PbRWR.- [(#b 4 G
CE#MP. )UL.9]^. []^. X %A?DCE#*)F-CE# egfhBji(k_l 4 n )UL.%]`? V [ V C S C )c\ ?A@ M LZ?D?&-JCE#W [ %A?DCE#*)] [(#b&?Na S \ C -4 G
0
K L.9]^. []^. B %A?DCE#*)F-\ .0))<? V . [>bRbR.Pb )<? )UL.M*?N#PO.0Q LR'&STS G
. #MP. )UL..0QR%&.PM0) .Pb #R'Ra V .9] ?A@ %A?DCE#*)F-dCE#)UL.M*?N# C M0) S C -F)[email protected]. [(#b 4 []^. =
2 k B $n G
K L C - C - )UL. .0QR%&.PM0) .Pb ? ] b&?N#. @ ? ] bR.9S .0) CE#W)UL. %A?DCE#*) 3 G
'Ra a CE#W ?AO.9] [RSTS)UL. -F) .9%Z- )UL. .0QR%&.PM0) .Pb)<? )/[RS ? ] C - + =
4 k = n
]`?Na S CE#.Z[]!C )c\ ?A@ .0QR%&.PM0)/[P) C ?N# )UL C - C - + k
=
4 B $n 2 k B=
4 X $n 2 k B S ?(WB n
! #"%$'& (*),+-$."%$0/ 121212121212121 3 465879;:<3 465>=?9
@BA-/.C D),+-$."%$0/ 121212121212121 3 465>E?9
FG0)IH*"KJML%J N G0)PORQ 121212121212121 3 465BST9
U )VGWQ*GWN L%J JXOMGW$ 121212121212121 Y 465>Z\[M]^5_9
` +."aO0b'Q-+-cdcB121212121212121 3 465>=?9
e
" H*" A.C GW$0A $ +*C ) 1212121212121 Y 465>Z\[M]^5_9
GW$0A. N " CRA I$ OR)VC N C $'& GWc 121212121212121
3 465>Z\[M]^5_9
1
1Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Voronoi Diagrams
• Definition
• Characteristics
• Size and Storage
• Construction
• Use
2Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
The Voronoi Diagram
3Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Voronoi RegionsEucledian distance :
dist(p,q) := ( ) ( )²² yyxx qpqp −+−
Let P :=p1,p2,...,pn be a set of n distinct points in a plane.We define the voronoi diagram of P as the subdivision of the planeinto n cells, with the property that a point q lies in the cell correspon-ding to a site pi iff dist(q,pi) < dist(q,pj) for each pj ∈ P with j ≠ i.
We denote the Voronoi diagram of P by Vor(P).The cell that corresponds to a site pi is denotd by V(pi), called thevoronoi cell of pi.
4Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Example
V(pi) = ∩1≤ j ≤ n, j ≠ i h(pi,pj)
q4
q1
q3
q2
p
5Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Computing the Voronoi DiagramInput: A set of points (sites) Output: A partitioning of the plane into regions of equal nearest neighbors
6Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Animations of the Voronoi diagram
http://wwwpi6.fernuni-hagen.de/java/JavaAnimation
pi
V(pi)
2
7Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Characteristics of Voronoi Diagrams1) Voronoi regions (cells) are bounded by line segments.
Special case :
Collinear points
Theorem : Let P be a set of n points (sites) in the plane.If all the sites are collinear, then Vor(P) consistsof n-1 parallel lines and n cells. Otherwise, Vor(P)is aconnected graph and its edges are either line segments or half-lines.
e
pi pj
pk
h(pi,pj)h(pj,pk)
If pi, pj, are not collinear with pk, thenh(pi, pj) and h(pj, pk) can not be parallel!
8Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Vor(P) is Connected
If Vor(P) is not connected then there would be a Voronoicell V(Pi) splitting the plane into two halfes. Beacuse Voronoi cells are convex, V(Pi) would consist of a strip bounded by two parallel full lines, but we know that edges of Voronoi diagram cannot be full lines, hence a contradiction.
Claim: Vor(P) is connectedProof by contradiction:
9Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Other Characteristics(Assumption: No 4 points are on the circle)
(2) Each vertex (corner) of VD(P)has degree 3
(3) The circle through the three pointsdefining a Vertex of the Voronoi diagram does not contain
any further point
10Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
(4) Each nearest neighbor of one point defines an edge of the Voronoi region of the point.
(5) The Voronoi region of a point is unbounded if the point lies exactly on the convex hull of the point set.
11Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Size and Storage
Size of the Voronoi Diagram:
V(p) can have O(n) vertices!
12Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
TheoremThe number of vertices in the Voronoi diagram of a set of n points in the plane is at most 2n-5 and the number of edges is at most3n-6.Proof: 1. Connect all Half-lines with fictitious point ∞
2. Apply Euler`s formula: v – e + f = 2
For VD(P) + ∞ : v = number of vertices of VD(P) + 1e = number of edges of VD(P)f = number of sites of VD(P) = n
Each edge in VD(P) + ∞ has exactly two vertices and each vertexof VD(P) + ∞ has at least a degree of 3:
⇒ sum of the degrees of all vertices of Vor(P) + ∞
= 2 · ( # edges of VD(P) )
≥ 3 · ( # vertices of VD(P) + 1 )
3
13Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Number of vertices of VD(P) = vp
Number of edges of VD(P) = ep
We can apply: (vp + 1) – ep + n = 2
2 ep ≥ 3 (vp + 1)
2 ep ≥ 3 ( 2 + ep - n)
= 6 + 3ep – 3n
3n – 6 ≥ ep
Proof(Continued)
14Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Example
15Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Storage of Voronoi-Diagrams
1
1
3
4
5
6
2
2 3
4
5
••
•
•
Three Records:
vertex CoordinatesIncident edge
;face
OuterComponentInnerComponents
;halfedge
OriginTwinIncidentFaceNextPrev
;
e.g. :
Vertices 1 = (1,2) | 12Sites 1 = 15 | [] Edges 54 = 4 | 45 | 1 | 43 | 15
16Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Computing the Voronoi DiagramInput: A set of points (sites) Output: A partitioning of the plane into regions of equal
nearest neighbors.
17Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Divide and Conquer(Divide)Input: A set of points (sites)
Output: A partitioning of the plane into regions of equalnearest neighbors.
Divide: Divide the point set into two halves
18Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Divide and Conquer (Conquer)
Conquer: Recursively compute the Voronoidiagrams for the smaller point sets
Abort condition: Voronoi diagram of a single point is theentire plane.
4
19Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Divide and Conquer (Merge)
Merge the diagrams by a (monoton) sequence of edges)
20Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
The ResultThe finished Voronoi Diagram
Running time: With n given points is O(n log n)
21Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Geometrical Divide and ConquerProblem: Determine all intersecting pairs of segments
A
BC
DE
A
BC
DE
S1 S2
S
EC
DA
B
22Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
DAC - Construction of the Voronoi diagramDivide:Divide P by a vertical dividing line T into 2 equal size subsets say P1 and P2. If |P| = 1 ⇒ completed.Conquer:Compute VD(p1) and VD(p2) recursively.
Merge:Compute the edge course K separating P1 and P2Cut VD(P1) and VD(P2) by means of K starting from Veinige Vor(P1) and Vor(P2) and K P1
P2
T
Theorem: K in O(n) ⇒ Running time T(n) = O(n log n)
Proof : T(n) = 2 T(n/2) + O(n), T(1) = O(1)
23Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Computation of K
P1 P2
First edge in K
Last edge in K
4 tangential points P1 P2Observation: K y - monotonous
Determines intersection s1 of m with Vor(p1) below lDetermines intersection s2 of m with Vor(p2) below l
Incremental (sweep line) construction(p1 in P1 and p2 in P2 perpendicular with m, Sweep l)
Extend K by line segment l siSet l = siCompute new K defining pair p1, p2
Theorem : Running time O(n)Proof : Vor(pi) are convex, therefore each one‘s
forward - edge are only visited once.
24Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Example
5
25Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Fortune´s Algorithm
Beach - line
Sweep - line
Observations:Intersection of the parabolas define edgesNew "telephones" ( ) define new parabolas Parabola intersection disappear, if C(P, q) has 3 points
26Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Use (static object set)Closest pair of points:Go through edge list for VD(P) and determine minimum
All next neighbors :Go through edge list for VD(P) for all points and getnext neighbors in each case
Minimum Spanning tree (after Kruskal)1. Each point p from P defines 1-element set of 2. More than a set of T exists
2.1) find p,p´ with p in T and p´ not in T with d(p, p´)minimum.
2.2) connect T and p´ contained in T´ (union)
Theorem : All computes in O(n log n)
27Lecture 8:Voronoi Diagram
Computational GeometryProf. Dr. Th. Ottmann
Applications (dynamic object set)Search for next neighbor :Idea : Hierarchical subdivision of VD(P)Step 1 : Triangulation of final Voronoi regions Step 2 : Summary of triangles and structure of a search tree Rule of Kirkpatrick :Remove in each case points with degree < 12,its neighbor is already far.
Theorem : Using the rule of Kirkpatrick a search treeof logarithmic depth develops.
A ab c a b c
A
1
1Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Duality and Arrangements
• Duality between lines and points
• Computing the level of points in an arrangement
• Arrangements of line segments
• Half-plane discrepancy
2Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Different duality mappingsA point p = (a,b) and a line l: y= mx + b are uniquely determined by two parameters.
a) Slope mapping: p * = L(p): y = ax + b
b) Polar mapping: p *: ax + by = 1
d) Duality transform:p = (a,b) is mapped to p *: y = ax – bl: y = mx + b is mapped to l* = (m, -b)
c) Parabola mapping: p*: y=2ax -b
3Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Duality transformp = (px,py)
( )( )bmbmxy
pxpypp yxyx
−+=−=
,,
a
a
Characteristics :
1. (p*)* = p = (px,py), (I*)* =l
p*:y = pxx – py
(p*)* = (px,py) = p
(I*)* = I
4Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Characteristics of the duality transform2) Incidence Preserving :
p = (px, py) lies on l: y = mx+b iff l* lies on p*
p lies on l iff py = mpx + b.
l* lies on p* iff (m,-b) fulfills the equation y = pxx – pyiff -b = pxm – py.
5Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Characteristics of the duality transform
3) Order Preserving : p lies above l iff l* lies above p*
p = (px, py)
(mpx + b)
l: y = mx +b
p lies above lpy > mpx + b
l* = (m,-b)
p*: y = pxx - py
(m, pxm – py)
l* lies above p*-b > pxm – py iff py > pxm + b
6Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Summary
Observations:
1. Point p on straight line l iff point l * on straight line p *
2. p above l iff l * above p *
2
7Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Computing the level of points in arrangements
Compute for each pair (p,q) of pointsand the straight line l(p,q) defined by p and q:
The number of points- above l(p, q) - on l(p, q)- below l(p, q)
⇒ running time (naive):
8Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Determining the number of points below a line
r is below l(p,q) iff l(p,q)* is below r *
p
q
r
l(p,q)
p* q*
r*
l(p,q)*
9Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Determining the level of points
Define for a set of straight lines for each intersection point p,the number of those straight lines, which run above p.
Definition: Level of a point p = # straight lines above p
p
10Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Levels of points in an arrangement
01
12
2 2
33
343
11Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Determining the levels of all Intersections
0 311
pl
Run time : O(n²)
1) Compute the level the leftmost intersection with other lines in time O(n) (comparison with all other straight lines).
2) Walk along the line and update the level at each intersection point
For each straight line:
12Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Arrangement of a set of n straight lines in the plane
Edges
Face
Vertex
3
13Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Size of an ArrangementTheorem :
Let L be a set of n lines in the plane, and let A(L) be the arrangement induced by L.
1) The number of vertices of A(L) is at most n(n-1)/2.
2) The number of edges of A(L) is at most n².
3) The number of faces of A(L) is at most n²/2 + n/2 + 1.
Equality holds in these three statements iff A(L) is simple.
Proof : Assume that A(L) is simple. 1) Any pair of lines gives rise to exactly one vertex
⇒ n(n-1)/2 vertices.2) # of edges lying on a fixed line = 1 + # of intersections on that line with all other lines, which adds up to n.So total number of edges of A(L) = n².
14Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Proof(Contd...)Bounding the # of faces
Euler‘s Formula : For any connected planar embedded graphwith mv veritces, me edges, mf faces the relationmv – me + mf = 2 holds.
We add a vertex v∞ to A(L) to get a connected planar embeddedgraph with v vertices, e arcs and f faces.
So we have f = 2 – (v + 1) + e
= 2 – (n(n - 1)/2 + 1) + n²
= n²/2 + n/2 + 1.
15Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Edges
Face
Vertex
16Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Storage of an Arrangement
A(L)R
Bounding-box R contains all vertices of A(L).
Store A(L) as doubly connected edge list.
17Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Computation of the Arrangement
Modify plane-sweep algorithm for segment intersection:Θ(n² log n), there are max. n² intersections.
Incremental algorithm, running in time O(n²)
1) Compute Bounding box B(L) that contains all verticesof A(L) in its interior.
2) Construct the doubly connected edge list for the sub-division induced by L on B(L).
3) for i = 1 to n1) do find the edge e on B(L) that contains the leftmost
intersection point of li and Ai.2) f = the bounded face incident to e.3) while f is not the unbounded face 4) do split f, and set f to be the next intersected face.
18Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Finding the next intersected faceIdea: Traverse along the edges of faces intersected by g
f gR
4
19Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Splitting a Face
f
f1
f2
• a new face• a new vertex• two new half-edges
Time : O(1)
20Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Zone TheoremComplexity of the zone of a line : Sum of number of edges and vertices of all intersected faces.
Zone Theorem : The complexity of the zone of a line in an arrangement of m lines in the plane is O(m).
Proof: By induction on m. (Omitted)
21Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
SupersamplingSupersampling in Ray Tracing
In order to handle arbitrary lines: Choose a random set of points(Supersampling):Shoot many rays through a box, take the average
22Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Computing the DiscrepancyUnit square U[0,1] x [0,1]
Half plane h
S is set of n sample points in U.
Discrete measure of h is µs(h)µs(h) := card (S ∩ h) / card(S).
H = set of all halfplanes
Continuous measureof half-plane h ∈ H is µ(h)
The half-plane discrepancy of a set S of n points is the supremumof all differences between the discrete and continuous measuresfor all halfplanes.
23Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
The discrepancy of h with respect to S, denoted as ∆s (h),is absolute difference between the continuous and discrete measure. ∆s (h) := | µ(h) - µs(h) |.
Halfplane discrepancy : ( ) ( )hs sHh
H ∆=∆∈sup:
Definition of half-plane discrepancy
24Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Example
5
25Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Computing the Discrepancy(contd...)
Lemma : Let S be a set of n points in the unit square U.
A half-plane h that achieves the maximum discrepancy with respect to S is of one of the following types :
1. h contains one point p ∈ S on its boundary.2. h contains 2 or more points of S on its boundary.
The number of type(1) candidates is O(n), and they can be found in O(n) time.
26Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
Example
27Lecture 9 :Arrangements and Duality
Computational GeometryProf. Dr. Th. Ottmann
First case : One point
px
1-py
(px, py)
u
v
a
a
a
1
1
A(a) = 1/2 (1 - py+ px tan a) (px + (1 - py) / tan a)
Area function has only finitely many extreme values!28Lecture 9 :
Arrangements and DualityComputational Geometry
Prof. Dr. Th. Ottmann
A(a) = 1/2 (1 - py+ px tan a) (px + (1 - py) / tan a)
with tan’ = 1/cos², (1/x)’ = -1/x², chain rule⇒ A’(a) = 1/2 (px² / cos² a + (1 - py)²/cos² a tan² a)A’(a) = 0 ⇒ px² - (1 - py)²/ tan² a
⇒ tan² a = (1 - py)²/px²
Discussion of the area function
1
1Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Overview
• Motivation.
• Triangulation of Planar Point Sets.
• Definition and Characterisitics of the Delaunay Triangulation.
• Computing the Delaunay Triangulation
(randomized, incremental).
• Analysis of Space and Time Requirement.
2Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Motivation
Transformation of a topographic map
into a perspective view
3Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
TerrainsGiven: A number of sample points p1..., pn
Required: A triangulation T of the points resulting in a “realistic” terrain.
"Flipping" of an edge:
900
93020
50
900
93020
50
Goal: Maximise the minimum angle in the triangulation
4Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Triangulation of Planar Point SetsGiven: Set P of n points in the plane (not all collinear).
A triangulation T(P) of P is a planar subdivision of the convex hull of P into triangles with vertices from P.
T(P) is a maximal planar subdivision.
For a given point set there are only finitely many differenttriangulations.
5Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Size of Triangulations
Theorem : Let P be a set of n points in the plane, not all collinearand let k denote the number of points in P that lie on the boundaryof convex of hull of P. Then any trianglation of P has 2n-2-ktriangles and 3n-3-k edges.
Proof :
Let T be triangulation of P, and let m denote the # of triangles of T. Each triangle has 3 edges, and the unbounded face has k edges.⇒ nf = # of faces of triangulation = m + 1every edge is incident to exactly 2 faces. Hence, # of edges ne = (3m +k)/2. Euler‘s formula : n - ne + nf = 2.Substituting values of ne and nf , we obtain:
m = 2n – 2 – k and ne = 3n – 3 – k .
6Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Angle Vector
Let T(P) be a triangulation of P ( set of n points). Suppose T(P) has m triangles.Consider the 3m angles of triangles of T(P), sorted by increasing value.A(T) = a1..., a3m is called angle-vector of T.
Triangulations can be sorted in lexicographical order according to A(T).
A triangulation T(P) is called angle-optimal if A(T(P)) ≥ A(T´(P))for all triangulations T´ of P.
2
7Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Illegal Edge
a1
a2
a6 a5
a3a4 Pj
Pi a1‘
a2‘ a4‘
a3‘a5‘
a6‘
Pk
Pj Pi
Edge flip
⇒
The edge pi pj is illegal if 6i1
min≤≤ 6i1
min≤≤
α‘i
Note: Let T be a triangulation with an illegal edge e. Let T´ be the triangulation obtained from T by flipping e. Then, A(T´) > A(T) .
αi <
8Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Legal Triangulation
Pi
Pk
Pj
Pl
Definition : A triangulation T(P) is called a legal triangulation, if T(P) does not contain any illegal edges.
Test for illegality
Lemma :
Let edge pipj be incident to triangles pipjpkand pipjpl , and let C be the circle thru pi,pjand pk . The edge pipj is illegal iff the point pl lies in the interior of C. Furthermore, if thepoints pi, pj, pk, pl form a convex quadri-lateral and do not lie on a common circle , then exactly one of pipj orpk pl is an illegal edge.
9Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Test of IllegalityObservation:
pl lies inside the circle through pi, pj and pk iff pk lies inside thecircle through pi, pj, pl . When all four points lie on circle, bothpipj and pkpl are legal.
10Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Thales Theorem
a
b
p
q
r
s
pipj
pk
pl
∠ asb< ∠ aqb = ∠ apb< ∠ arb
illegal
Lemma: Let C be the circle through the triangle pi, pj, pk and let the point pl be the fourth point of a quadrilateral.The edge pipj is illegal iff pl lies in the interior of C.
11Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
pi pj
pl
pk
pi pj
pl
pk
Consider the quadrilateral with pl in the interior of the circle that goes through pi, pj, pk.
Claim: The minimum angle does not occur at pk!
(likewise: Minimum angle does not occur at pl )
Goal: Show that pipj is illegal
12Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
pi pj
pk
pl
a1a2
a3a4
pi pj
pk
pl
a1a2
a3a4
a1‘a2‘
a3‘ a4‘
pi pj
pk
pl
a1‘a2‘
a3‘ a4‘
W.l.o.g.
a4 minimal
3
13Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
pi pj
pk
pl
a1a2
a3a4
a1‘a2‘
a3‘ a4‘
Circle criterion violated ⇒ illegal edge
14Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
pk
pipj
pl
pipj
pl
Assumption:edge pkpl is illegal, and circle criterion is not violated
Then: Edge pipj is also illegal,
a contradiction!pk
15Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Circle Criterion
Definition:A triangulation fulfills the circle criterion if and only if the circumcircle of each triangle of the triangulation does not contain any other point in its interior.
16Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Theorems
Theorem:A triangulation T(P) of a set P of points does not contain an illegal edge if and only if nowhere the circle criterion is violated.
Theorem:Every triangulation T(P) of a set P of points can be finally transformed into an angle-optimal triangulation in a finite number of steps.
17Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Definition and characteristics of the Delaunay triangulation
The Delaunay Triangulation DT(G) is the straight line dual of the Voronoi diagram.Vertices: Points (sites) of the Voronoi regions Edges: Between any two points of neighbouring Voronoi regions
Each Voronoi vertex is the center of a triangle of the Delaunay triangulation (for sets of points (sites) in general position).
18Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Planarity of the Delaunay Graph DG(P)
pi
pj
Tij
Cij
Theorem:The Delaunay Triangulation DT(P) of a set of points P is planar.
Proof:Let pipj be an edge of DT(P). Then there is an empty circle Cij, that goes through pi and pj.
Tj, the center of Cij , is on the common edge of V(pi) and V(pj).
4
19Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
t
t contains no sites
20Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
21Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Delaunay Triangulation
Vf
A set of points P is in general position if it contains no 4 points on a circle
For point sets in general position all vertices of the Voronoi diagram have degree 3 and all bounded faces of DT(P) are triangles
In any case: All faces of DT(P) are convex
DT(P) = Triangulation of DG(P)
22Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Characterisation of the Delaunay Triangulation
Theorem:Let P be a set of points in the plane (in general position), and letT be a triangulation of P. Then T is a Delaunay Triangulation of Pif and only if the circumcircle of any triangle of T does not contain any other point of P in its interior (i.e. T fulfills the circle criterion).
23Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Equivalent characterisations of the Delaunay Triangulation
1. DT(P) is the straight-line-dual of VD(P).
2. DT(P) is a triangulation of P such that all edges are legal (local angle-optimal).
3. DT(P) is a triangulation of P such that for each triangle the circle criterion is fulfilled.
4. DT(P) is global angle-optimal triangulation.
5. DT(P) is a triangulation of P such that for each edge pipj there is a circle, on which pi and pj lie and which does not contain any other point from P.
24Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Computation of the Delaunay Triangulation(randomized, incremental)
Given: Point set P = p1..., pn
Initially: Compute triangle (x, y, z), which includes the points p1..., pn.
m
z (0,3m)
y (3m,0)
x (-3m,-3m)
5
25Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Algorithm DT(P)
m = max |xi|,|yi|
T = ((3m, 0), (3m, 3m), (0, 3m))
1. initialize DT(P) as T.
2. permutate the points in P randomly.
3. for r = 1 to n do
find the triangle in DT(P), which contains pr;
insert new edges in DT(P) to pr;
legalize new edges.
4. remove all edges, which are connected with x, y or z.
26Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Inserting a point
pi
pj
pr
pkpi
pj
pkpr
pl
pi
pj
pk
pr
2 cases : pr is inside a triangle pr is on an edge
Legalize (pr,pipj,T)if pipj is illegal
then Let pipjpk be the triangle adjacentto prpipj along pipj.Legalize (pr, pipk, T)Legalize (pr, pkpj, T)
27Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Algorithm Delaunay Triangulation Input: A set of points P = p1..., pn in general position
Output: The Delaunay triangulation DT(P) of P1. DT(P) = T = (x, y, z)2. for r = 1 to n do3. find a triangle pipjpk ∈ T, that contains pr.4. if pr lies in the interior of the triangle pipjpk
5. then split pipjpk6. Legalize(pr, pipj), Legalize(pr, pipk),
Legalize(pr, pjpk)7. if pr lies on an edge of pipjpk (say pipj)8. then split pipjpk and pipjplLegalize (pr, pipl), Legalize (pr, pipk),
Legalize (pr, pjpl), Legalize (pr, pjpk)9. Delete (x, y, z) with all incident edges to P
28Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
CorrectnessLemma :Every new edge created in the algorithm for constructing DT during the intersection of pr is an edge of the Delaunay graph of Ω ∪ p1,...,pn .pq is a Delaunay edge iff there is a (empty) circle, which contains only p and q on the circumference.
Proof idea : Shrink a circle which was empty before addition of pr !
29Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
pr
pr
Observation: After insertion of pr , every new edge produced by edge-flips is incident to pr!
Correctness of the algorithm: Consider newly produced edges:
⇒
30Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
pr
pi
pj
pk
Edge-flips produce only legal edges.
Before inserting pr , circle that goes through pi, pj, pk was empty!
Edge-flips produce edges that are always incident to pr !
6
31Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Data Structure for Point Locationt1
t2
t3
t2
t3
t4t5
t4
t6t7
t1 t2
t4 t5
t3
t6 t7
t1 t2 t3
t1 t2 t3
t1 t2
t4 t5
t3
⇓ Split t1
⇓ flip pipj
⇓ flip pipk
pi
pj
pi pk
32Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Analysis of the Algorithm for Constructing DT(P).
Lemma :
The expected number of triangles created by the incremental algorithm for constructing DT(P) is atmost 9n + 1.
33Lecture 10 :Delaunay Triangulation
Computational GeometryProf. Dr. Th. Ottmann
Analysis of the Running time
Theorem :
The Delaunay triangulation of a set of P of n points in theplane can be computed in O(n log n) expected time, usingO(n) expected storage.
Proof :
Running time without Point Location :Proportional to the number of created triangles = O(n).
Point Location :The time to locate the point pr in the current triangulationis linear in the number of nodes of D that we visit.
1
1Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Geometric Data Structures
1. Rectangle Intersection
2. Segment trees
3. Interval trees
4. Priority search trees
2Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Rectangle Intersection
- Sweep a horizontal Scan-Line from top to bottom.- Store the intersection points with the rectangles in a status
structure L.
3Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Operations on L
- Insertion of an interval into L
- deletion of an interval from L
- For a given interval I :Determine all intervals from L, which overlapthemselves with I
L stores a set of intervals over a discrete and well-knownuniverse of possible end-points.
4Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Reduction of the overlap-query
x y x x xy y y
a b a b a b a b
5Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Segment Trees
Segment trees are a structure for storing sets of intervals, which support the following operations:
- insertion of intervals
- deletion of intervals
- stabbing queries:For a given point A, report all intervalswhich contain A (which are stabbed by A)
For the solution of the rectangle intersection problem semi-dynamic segment trees are sufficient.
6Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Example
An interval I is in the list of a vertex p if and only if p is the first node from the root, so that the interval of I(p) is contained in I.
Insertion of an interval is possible in O(log n) steps.
AB C D
E F
2
7Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Size of a Segment Tree
I
Each interval of I appears in at the most O(log n) interval lists.
Construction of a segment tree with n intervals is possible in time O(n log n).
8Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Algorithm for answering stabbing queriesA
B C DE F
procedure report (p: node ; x: point): report all intervals of the list of p; if p is leaf then finish else if (p has left child pl & x in I(pl))
then report(pl, x); if (p has right child pr & x in I(pr))
then report(pr, x); Using the segment tree all intervals that contain a query point can be reported in time O(log n + k), where k is the number of reported intervals.
9Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
I
I
I
I
I
I
Dictionary for all intervals
Deletion of Intervals
10Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Interval Trees
o- Lists
u- ListsS
Skeleton (complete search tree of the interval boundaries)
o-Lists sorted according to descending upper end points
u-Lists sorted according to ascending lower end points
Interval [ l,r ] is stored in the u-/ o-list of the node s forwards if and only if s of the knots of minimum depth is, so that s lies in [ l,r ].
11Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Insertion and deletion of intervals in an interval tree with skeleton of size O(n) and altogether O(n) intervals can be carried out in time O(log n).
[1, 5], [1, 7], [3, 4]
[1, 7], [1, 5], [3, 4]
[5, 7], [6, 7]
[5, 7], [6, 7]
[1, 2]
[1, 2]
1
2
3 5
6
4
7
Example
[1, 2], [1, 5], [3, 4], [5, 7], [6, 7] , [1, 7]
12Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
X < p.keyX
X > p.keyX
Procedure report (p :nodes, x : points)if x = p.key then report all intervals of the u/o – listselse if x < p.key then report beginning of the u-list;
report(pl, x) else (x > p.key) report beginning of the o - list;
report(pr, x) Stabbing queries can be answered in O(log n + k) time, where k is the number of reported intervals.
u - lists o - lists
3
13Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Priority Search Trees
A B
C
DA
B
CD
l rx y
14Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Priority Search Trees
Priority Search trees are a 1.5-dim structure for the storage of points, they support the following operations :
Insertion of a pointDeletion of a point South-grounded range queries
15Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Priority Search Trees
1,34
2,42
3,73
1
1
32 4 5
5
6
6
7
7 8
Priority search trees are - binary leaf search trees for the x-coordinates of the points. - min heaps for the y-coordinates of the points.
M = (1, 3), (2, 4), (3, 7), (4, 2), (5, 1), (6, 6), (7, 5), (8, 4)
16Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Insertion
Insertion of a point p = (x, y) : Deposite p on the search path for x according to its y-value! I.e. if on the way down the tree, p meets a point q, with larger y-value, then deposit p there and and continue the procedure with q.
Insertion of a point can be carried out in time O(log n).
17Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Deletion
Look for point p in the tree and remove it; Close the gaps (recursively) by pulling up the point,with smaller y-value. Deletion of a point is possible in time O(log n).
5,14
4,22
3,73
1
1,31
3 4 5 6 7 8
6,65
7,57
2,42
8,46
18Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
South-grounded range queries (x, x´, y) :
Search for x and x´. Report all points with y-value < y within the range between these borders.
x
y
x´
Executable in O(log n + k) time.
4
19Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
2,26
6,42
7,37
2
6
Possibilities for the full dynamization of priority search trees:No rigid skeleton, but growing or shrinking with the point set.
Inserting (5,3)
20Lecture 11 :More Geometric Data Structures
Computational GeometryProf. Dr. Th. Ottmann
Balanced trees as skeletons
qx´
px
1 2
3
x
x´
1
2 3
⇒
Rotation conserves the x-order and destroys in general the y-order.
1
1Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Special Cases of the Hidden Line Elimination Problem
HLE– Problem :Produce a realistic image of a given 3- d scene under orthographicprojection by eliminating hidden lines.
3 - d Scene :
Set of bounding polygonal faces ; each face given by its plane equation and the sequence of its edges ; each edge given by its endpoints.
Special Cases :
Set of 1) rectilinear faces
2) C- oriented faces
2Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Visibility problems
Hidden-line-elimination
Visible surface computation
3Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Problem SetsProblem A :Set of aligned rectangular faces in 3 - space;
each face parallel to the projection plane.
4Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Problem Sets
Problem B :
Set of C- oriented polygonal faces in 3 - space; all parallel to the projection plane.
Only C different edge directions
5Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Problem SetsProblem C :
Set of C- oriented solids in 3 – space.
Projection of the faces onto the projection plane yields a set of C´-oriented polygons where
( )²2
´ CC
C Ο=
=
Solution methods:- plane- sweep- dynamic contour maintenance
6Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Plane sweep solution of Problem A
X
Y
Z
view
sweep
sweepY
X
x view
l
2
7Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
When sweeping the X- Z- plane in Y- direction:
horizantal line segments- appear- stay for a while- disappear
view
X
Z
l
Plane sweep solution of Problem A(contd...)
8Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
for each rectangle edge l with left endpoint p doCompute the coverage number c of p w.r.t. the currently active faces in front of p;
p lx
z
view
Scan along l updating c; report all pieces with c = 0 as visible
1 0 1 2 1 1x
Coverage no
1.2.
L = Set of currently active line segments
for each end of a line segment l´ in L passed when scanningalong l doif l´ is above l then update c;
output visible piece, if c becomes 0else ignore this end
9Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Subproblems
Subproblem 1:
Given a set L of horizontal line segments and a query point p, determine the number of segments in L that are above p.
Subproblem 2:
LX = set of X- values of endpoints of segments in L
For a given X- interval iX retrieve the coordinates in LX enclosed by iX in X- order.
L and LX must allow insertions and deletions
10Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Solution of Subproblem 2
Dynamic (or semi-dynamic) range tree
re = # vertical edges that intersect l
O( log n + re)
Above- l- test:
By associated Z- valuesin O(1) time
Xi(Zi)
iX
11Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Segment - range treeSubproblem 1: Determine the number of segments above a query point
a
a a
b
b b
c
c
cd
d
x
z
1. Store the X- intervals in a segment tree2. Organize the node lists as range trees
according to their Z- values
d
a
Segment - Rank tree(O log² n )
Query interval
Retrieval of the t segments in L with Z- values in takes time O( log² n + t )We need only the number of those segments
12Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Time Complexity
For each rectangle edge e :
O( log² n ) for solving subproblem 1
O( log² n + ke ) for solving subproblem 2
O( log² n ) for inserting/ deleting a horizontal line segment in a segment range tree
O( log n ) for inserting/ deleting two coordinatesin a range tree
3
13Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Space complexity
O( n log n ) for storing a segment range tree of n elements
Theorem:
For a set of n rectangular faces, Problem A can be solvedin O( n log² n + k ) time and O( n log n ) space, where kis the number of edge intersections in the projection plane
Compare with O( ( n+k ) log n ) time!
14Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Problem BProblem B: C- oriented polygonal faces
all parellel to the projection plane
Main idea: Use C different data structures, one for each edge orientation (speed)
x view
sweep
α
XY
X
Y
15Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Store moving horizontal objects in a data structure that movesat the same speed as the objects stored in it
Represent horizontal segments by two half-lines
moving moving
moving
fixed
(1-1) = 0
S S´
S S´ -1
+1
0 1
⇓
( [x1,x2], y ) ⇒ ( [x1,∞], y, +1)( [x2,∞], y, -1 )
16Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Subproblem 1: ( Determining the number of segments above query point p )
For each speed S of the C possible speeds:Store the segments with endpoints moving at speed S in a segment rank tree (associated to S )
To obtain the number of segments above p:query all C segment range trees and add the results
C segment rank trees
Problem B can be solved with the same asymptotic time and space bounds as Problem A
( O( n log² n + k ) time, O( n log n ) space )
17Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
C – Oriented Solids in 3 - SpaceProblem C: ( C- oriented solids in 3- space)
Preprocessing step (requires O( n ) time)
1. Compute the set of faces
2. Remove all back faces
C orientations of faces C´ = edge orientations
2C
18Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Problem C (contd...)
For each edge-orientation α perform a plane-sweep by choosing a sweep plane which is parellel to α and the direction of view.
viewX sweep
α
4
19Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Moving Segments in the Sweep Plane
Moving segments in the sweep plane
Intersection of the sweep plane with any face is still a line segment having one of C different orientations,
each of its endpoints moves at one of C´= different (speed, direction ) pairs
2C
p
l
view
X sweep
20Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Moving Segments in the SweepPlane(contd...)
Apply the same solution technique
Represent slanted segments by pairs of slanted half-lines
moving moving
fixed+1 -1
∞
21Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Solution of Problem C
Same technique as for Problem B is applicable.
Solution of Problem C: (C- oriented solids)
time O( n log² n + k )space O( n log n )
time and space increase with O( C³ )
»» feasible only for small values of C
Best known algorithm for the general problem
A. Schmitt: time O( n log n + k log n )space O( n + k )
22Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
n = size of inputk = # edge intersections in projected sceneq = # visible edges
large block hiding a complicated scene»» k = O( n² ) , q = O ( 1 )
Problem:Does there exist any algorithm for the HLE- problem whose complexity does not depend on k but only on nand q , i.e. on the number of visible line segments ?
Output sensitive HLE
23Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Problem A yes( rect. faces, parellel to proj. plane )
Problem B yes( C- oriented faces, parellel to proj. plane )
Problem C ?( C- oriented solids )
Solution technique:
Dynamic contour maintenancewhen scanning the objects from front to back
24Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Special Case of HSR / HLE :Window Rendering
Isothetic rectangles in front – to – back order.
Visible portion
x
yz
x
y
5
25Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Dynamic Contour Maintenance
Construct the visible scene by inserting objects from the front to the back into an intially empty scene.
At each stage maintain the contour of the area covered by objects so far. When encountering a new object check it against the current contour to determine its visible pieces and update the contour.
Dynamic contour maintenance
26Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Front to Back Strategy1. Sort the rectangles by increasing depth and treat them in this order
2. Maintain the visible contour of the rectangles treated so far
⇓
Compute1 ) all intersections of r and c2 ) all edges of r completely inside / outside C3 ) all edges of C completely inside r
27Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Updating the contour
Case A: Updating the contour
maintain:
E set of contour edges
F set of rectangles whose union is the area within the contour
⇓
28Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Algorithm Algorithm CONTOUR – HLEInput A set of n rectangular aligned faces R,
all parellel to the projection planeOutput The set of visible pieces of edges defined by RMethod Sort R by z- coordinates (distance to the observer)
E := φ set of contour edges F := φ set of rectangles whose union is bounded by E
Scan R ( according to ascending z-values )
for each rectangle r ∈ R do1. Compute all intersections between edges in r and
edges in E1a for each intersected edge e ∈ E do
delete e from E;compute the parts e outside r insert them into E
od
29Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Algorithm (contd...)for each edge e´of r intersecting same edge in E do
1b compute the pieces of e´ outside the contour;report those pieces as visible;insert those pieces into E;
od2. for each edge e´ of r not intersecting anything do
check e´ using F whether it is completely inside the contour ( hidden );if e´ is not inside
then report e´ as visible;insert e´ into E fi
od3. Find all edges in E that are completely inside r and
delete them from E;
4. Insert r into Fend CONTOUR - HLE
30Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Updating the contour
E
E
E
r r
r
(a)
(b)
(c)
1a
1a
1b
32
1b
6
31Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Subproblems Find intersections between edges in E and r
Segment – Range tree
Given a set of rectangles F and a query point p: check whether p is in UF.
Segment – Segment tree
Given a set P of (left end-) points (of edgesin E) and a query rectangle r:find all points of P inside r.
Range – Range tree
32Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Sub Problems
Compute intersection between edges in r and C. segment – range tree for horizontal , vertical edges of C.
Point – Location in the planar subdivision∪ C.
segment – segment tree .
Range query for determining all points (representing edges of C) completely inside r. range – range tree.
Structures must be dynamic , i.e. Supportinsert / delete operations efficiently.
33Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Subproblems contd...
Representation of set E of contour edges:
segment – range tree for horizontal edgessegment – range tree for vertical edgesrange – range tree for left / bottom end points
Representation of set of rectangles :
segment – segment tree
Update and query take time O(log² n) (+t)
34Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Segment – Range Tree
Reporting all k intersections in time O(log ² n + k)x
y a bcd ef
b
ac c
ff
ff
d
d caa
35Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Theorem
For each rectangular face r a constant number of operations at acost O(log² n) per operation is performed. Additional cost arises for each contour edge found as intersecting in step 1 or enclosedin step 3.
Theorem :For a set of n rectangles, problem A can be solved by dynamic contour maintenance in O((n + q) log² n) time and O((n + q) log n)space where q is the number of visible line segments.
The solution carries over to problem B but not to problem C; because no scanning (´´separation´´) order is defined for problem C.
36Lecture 12 :Special Case of Hidden-Line-Elimination
Computational GeometryProf. Dr. Th. Ottmann
Theorem (Ottmann / Güting 1987) :The window rendering problem for n isothetic rectangles can be solved in time O((n + k) log² n), where k is the size of the output.Improvements Bern 1988
O(n log n log log n + k log n)Preparata / Vitto / Yvinec 1988
O(n log² n + k log n)Goodrich / Atallah / Overmars 1989
O(n log n + k log n) orO(n 1+ q + k)
Bern 1990O((n + k) log n)
Can be extended to C – oriented polygons (in depth order)Problems : 1) arbitrary polygons (in depth order)
2) no depth order
Theorem(Ottmann / Güting)