convex hull & line segment intersection
TRANSCRIPT
![Page 1: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/1.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Guido Bruckner
Computational Geometry – Problem Session
LEHRSTUHL FUR ALGORITHMIK · INSTITUT FUR THEORETISCHE INFORMATIK · FAKULTAT FUR INFORMATIK
Convex Hull & Line Segment Intersection
04.05.2018
Guido Bruckner · Computational Geometry – Problem Session
![Page 2: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/2.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Modus Operandi
To register for the oral exam we expect you to present anoriginal solution for at least one problem in the exercisesession.
• this is about working together• don’t worry if your idea doesn’t work!
![Page 3: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/3.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Outline
Convex Hull
Line Segment Intersection
![Page 4: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/4.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Definition of Convex Hull
Def: A region S ⊆ R2 is called convex, when for two pointsp, q ∈ S then line pq ∈ S.The convex hull CH(S) of S is the smallest convexregion containing S.
![Page 5: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/5.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Definition of Convex Hull
Def: A region S ⊆ R2 is called convex, when for two pointsp, q ∈ S then line pq ∈ S.The convex hull CH(S) of S is the smallest convexregion containing S.
![Page 6: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/6.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Definition of Convex Hull
Def: A region S ⊆ R2 is called convex, when for two pointsp, q ∈ S then line pq ∈ S.The convex hull CH(S) of S is the smallest convexregion containing S.
In physics:
![Page 7: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/7.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Definition of Convex Hull
Def: A region S ⊆ R2 is called convex, when for two pointsp, q ∈ S then line pq ∈ S.The convex hull CH(S) of S is the smallest convexregion containing S.
In physics:• put a large rubber band
around all points
![Page 8: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/8.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Definition of Convex Hull
Def: A region S ⊆ R2 is called convex, when for two pointsp, q ∈ S then line pq ∈ S.The convex hull CH(S) of S is the smallest convexregion containing S.
In physics:• put a large rubber band
around all points• and let it go!
![Page 9: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/9.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Definition of Convex Hull
Def: A region S ⊆ R2 is called convex, when for two pointsp, q ∈ S then line pq ∈ S.The convex hull CH(S) of S is the smallest convexregion containing S.
In physics:• put a large rubber band
around all points• and let it go!• unfortunately, does not help
algorithmically
![Page 10: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/10.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Definition of Convex Hull
Def: A region S ⊆ R2 is called convex, when for two pointsp, q ∈ S then line pq ∈ S.The convex hull CH(S) of S is the smallest convexregion containing S.
In physics:• put a large rubber band
around all points• and let it go!• unfortunately, does not help
algorithmically
In mathematics:
• define CH(S) =⋂
C⊇S : C convex
C
• does not help :-(
![Page 11: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/11.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Algorithmic Approach
Lemma:For a set of points P ⊆ R2, CH(P ) isa convex polygon that contains P andwhose vertices are in P .
![Page 12: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/12.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Algorithmic Approach
Lemma:For a set of points P ⊆ R2, CH(P ) isa convex polygon that contains P andwhose vertices are in P .
Input: A set of points P = p1, . . . , pnOutput: List of nodes of CH(P ) in clockwise order
![Page 13: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/13.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Algorithmic Approach
Lemma:For a set of points P ⊆ R2, CH(P ) isa convex polygon that contains P andwhose vertices are in P .
Input: A set of points P = p1, . . . , pnOutput: List of nodes of CH(P ) in clockwise order
Observation:
(p, q) is an edge of CH(P ) ⇔ each point r ∈ P \ p, q• strictly right of the oriented line −→pq or• on the line segment pq
p q
−→pq
![Page 14: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/14.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Running Time Analysis
FirstConvexHull(P )
E ← ∅foreach (p, q) ∈ P × P with p 6= q do
valid ← trueforeach r ∈ P do
if not (r is strictly right of −→pq or r ∈ pq) thenvalid ← false
if valid thenE ← E ∪ (p, q)
construct the sorted node list L from CH(P ) out of Ereturn L
Θ(1
)Θ
(n)
(n2 − n)·
Θ(n
3)
Question: How do we implement this?
![Page 15: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/15.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Solution
Set of edges.
![Page 16: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/16.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Solution
Set of edges.
Sort from right to left?
w.r.t. source vertex
Edges that point to the leftor to the bottom.
Sort fromleft to right?
w.r.t. source vertex
Edges that point to theright or to the top.
![Page 17: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/17.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Solution
Set of edges.
Sort from right to left?
w.r.t. source vertex
Edges that point to the leftor to the bottom.
Sort fromleft to right?
w.r.t. source vertex
?if not unique:from bottom to top.from top to bottom.
Edges that point to theright or to the top.
![Page 18: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/18.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Solution
Set of edges.
Sort from right to left?
w.r.t. source vertex
Edges that point to the leftor to the bottom.
Sort fromleft to right?
w.r.t. source vertex
?if not unique:from bottom to top.from top to bottom.
Edges that point to theright or to the top.
![Page 19: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/19.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
![Page 20: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/20.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
![Page 21: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/21.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
![Page 22: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/22.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
![Page 23: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/23.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
![Page 24: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/24.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
![Page 25: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/25.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
![Page 26: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/26.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
![Page 27: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/27.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
![Page 28: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/28.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
p2
![Page 29: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/29.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
p2p3
![Page 30: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/30.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
p2p3
p4
![Page 31: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/31.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
p1
p2p3
p4
p5
![Page 32: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/32.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
= p6p1
p2p3
p4
p5
![Page 33: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/33.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Correctness (ideas):
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
![Page 34: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/34.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Correctness (ideas):• Base Case: p1 lies on convex hull.
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
![Page 35: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/35.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Correctness (ideas):• Base Case: p1 lies on convex hull.
• Assumption: First i points belong to convex hull CH(P )
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
![Page 36: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/36.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Correctness (ideas):• Base Case: p1 lies on convex hull.
• Assumption: First i points belong to convex hull CH(P )
• Step: By assump. pi+1 lies to the right of line −−−−→pi−1pi ⇒ ’right bend’
By the chosen angle: all points lie to the right of line −−−−→pipi+1
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
![Page 37: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/37.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Degenerated cases:
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
![Page 38: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/38.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Alternative: Gift Wrapping
Degenerated cases:
1. Choice of p1 is not unique.
Choose the bottommost rightmost point.
2. Choice of pj+1 is not unique.
Choose the point of largest distances.
Idea: Begin with a point p1 of CH(P ), then find the next edge ofCH(P ) in clockwise order.
GiftWrapping(P )
p1 = (x1, y1) ← rightmost point in P ; p0 ← (x1,∞); j ← 1while true do
pj+1 ← arg max∠pj−1, pj , q | q ∈ P \ pj−1, pjif pj+1 = p1 then break else j ← j + 1
return (p1, . . . , pj+1)
![Page 39: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/39.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
Find: right tangent at P through p in O(log n) time.Given: convex polygon P (clockswise) and point p outside of P
Right tangent means polygon lies leftto tangent.
![Page 40: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/40.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
midpoint c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
Find: right tangent at P through p in O(log n) time.Given: convex polygon P (clockswise) and point p outside of P
Idea: Use binary search.
p1
p2
p3 p4p5
p6
p7
p8p9
p10
p
Right tangent means polygon lies leftto tangent.
![Page 41: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/41.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
midpoint c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
Find: right tangent at P through p in O(log n) time.Given: convex polygon P (clockswise) and point p outside of P
Idea: Use binary search.
p1
p2
p3 p4p5
p6
p7
p8p9
p10
p
Right tangent means polygon lies leftto tangent.
![Page 42: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/42.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
midpoint c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
Find: right tangent at P through p in O(log n) time.Given: convex polygon P (clockswise) and point p outside of P
Idea: Use binary search.
p1
p2
p3 p4p5
p6
p7
p8p9
p10
p
Right tangent means polygon lies leftto tangent.
![Page 43: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/43.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
midpoint c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
Find: right tangent at P through p in O(log n) time.Given: convex polygon P (clockswise) and point p outside of P
Idea: Use binary search.
p1
p2
p3 p4p5
p6
p7
p8p9
p10
p
Right tangent means polygon lies leftto tangent.
![Page 44: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/44.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
midpoint c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
Find: right tangent at P through p in O(log n) time.Given: convex polygon P (clockswise) and point p outside of P
Idea: Use binary search.
p1
p2
p3 p4p5
p6
p7
p8p9
p10
p
`
Right tangent means polygon lies leftto tangent.
![Page 45: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/45.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
midpoint c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
Find: right tangent at P through p in O(log n) time.Given: convex polygon P (clockswise) and point p outside of P
Idea: Use binary search.
p1
p2
p3 p4p5
p6
p7
p8p9
p10
p
`
Right tangent means polygon lies leftto tangent.
![Page 46: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/46.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
midpoint c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
Find: right tangent at P through p in O(log n) time.Given: convex polygon P (clockswise) and point p outside of P
Idea: Use binary search.
p1
p2
p3 p4p5
p6
p7
p8p9
p10
p
`
How to test in constant time?
Right tangent means polygon lies leftto tangent.
![Page 47: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/47.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
middle c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
ppj
pi
pi lies above pj , if pj lies left to −→ppi.
![Page 48: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/48.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
middle c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
ppj
pi
pi lies above pj , if pj lies left to −→ppi.
Assumption: −→ppi points from right to left.
![Page 49: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/49.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Computation of Tangents
[a, b]← [1, n]while tangent not found do
middle c = ba+b2 c
if ppc is tangent then return pcif [c, b] contains index of contact point then
[a, b]← [c, b]
else[a, b]← [a, c]
ppj
pi
pi lies above pj , if pj lies left to −→ppi.
pa pc
pb
p
pa+1 above pa:
pa above pa+1: Analogous statements.
[a, b]← [a, c]
pc above pc+1
pc
pa
pbp
[a, b]← [c, b]
pc+1 above pc
pc
pa
pb p
[a, b]← [a, c]
pc+1 above pcpc above pa pa above pc
Assumption: −→ppi points from right to left.
![Page 50: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/50.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Lower Bound
We require that any algorithm computing the convex hull of agiven set of points returns the convex hull vertices as aclockwise sorted list of points.
![Page 51: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/51.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Lower Bound
We require that any algorithm computing the convex hull of agiven set of points returns the convex hull vertices as aclockwise sorted list of points.
1. Show that any algorithm for computing the convex hull ofn points has a worst case running time of Ω(n log n) andthus Graham Scan is worst-case optimal.
![Page 52: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/52.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Lower Bound
We require that any algorithm computing the convex hull of agiven set of points returns the convex hull vertices as aclockwise sorted list of points.
1. Show that any algorithm for computing the convex hull ofn points has a worst case running time of Ω(n log n) andthus Graham Scan is worst-case optimal.
2. Why is the running time of the gift wrapping algorithm notin contradiction to part (a)?
![Page 53: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/53.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Outline
Convex Hull
Line Segment Intersection
![Page 54: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/54.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Problem Formulation
Given:Set S = s1, . . . , sn of line segments in the plane
Output: • all intersections of two or more line segments• for each intersection, the line segments involved.
![Page 55: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/55.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Problem Formulation
Given:Set S = s1, . . . , sn of line segments in the plane
Output: • all intersections of two or more line segments• for each intersection, the line segments involved.
Def: Line segments are closed
![Page 56: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/56.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Problem Formulation
Given:Set S = s1, . . . , sn of line segments in the plane
Output: • all intersections of two or more line segments• for each intersection, the line segments involved.
Def: Line segments are closed
![Page 57: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/57.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Warm Up
Algorithm that determines whether a polygon has noself-intersection using O(n log n) running time.
Find:
![Page 58: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/58.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 59: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/59.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
Events
![Page 60: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/60.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 61: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/61.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
sweep line
![Page 62: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/62.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 63: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/63.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 64: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/64.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 65: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/65.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 66: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/66.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 67: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/67.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 68: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/68.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 69: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/69.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 70: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/70.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 71: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/71.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 72: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/72.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 73: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/73.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 74: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/74.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 75: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/75.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 76: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/76.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 77: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/77.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 78: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/78.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 79: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/79.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Sweep-Line: Example
![Page 80: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/80.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Data Structures
1.) Event Queue Q• define p ≺ q ⇔def. yp > yq ∨ (yp = yq ∧ xp < xq)
p q`
• Store events by ≺ in a balanced binary search tree
→ e.g., AVL tree, red-black tree, . . .
• Operations insert, delete and nextEvent in O(log |Q|) time
2.) Sweep-Line Status T `
• Stores ` cut lines ordered from left to right
• Required operations insert, delete, findNeighbor
• This is also a balanced binary search tree with line segments stored inthe leaves!
![Page 81: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/81.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Algorithm
FindIntersections(S)
Input: Set S of line segmentsOutput: Set of all intersection points and the line
segments involvedQ ← ∅; T ← ∅foreach s ∈ S doQ.insert(upperEndPoint(s))Q.insert(lowerEndPoint(s))
while Q 6= ∅ dop← Q.nextEvent()Q.deleteEvent(p)handleEvent(p)
![Page 82: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/82.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Algorithm
handleEvent(p)
U(p)← Line segments with p as upper endpointL(p)← Line segments with p as lower endpointC(p)← Line segments with p as interior pointif |U(p) ∪ L(p) ∪ C(p)| > 1 then
report p and U(p) ∪ L(p) ∪ C(p)
remove L(p) ∪ C(p) from Tadd U(p) ∪ C(p) to Tif U(p) ∪ C(p) = ∅ then //sl and sr, neighbors of p in TQ ← check if sl and sr intersect below p
else //s′ and s′′ left- and rightmost line segment in U(p) ∪ C(p)Q ← check if sl and s′ intersect below pQ ← check if sr and s′′ intersect below p
![Page 83: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/83.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Space Consumption
Running time: O((n + I) log n)Storage: O(n + I)
Find algorithm that needs linear space.
Which data structure may use more than linear space?
Find:
Lecture:
Question:
![Page 84: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/84.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Space Consumption
Running time: O((n + I) log n)Storage: O(n + I)
Find algorithm that needs linear space.
Which data structure may use more than linear space?
Find:
Lecture:
Question:
Event-Queue may contain 2n + I many events,where I ∈ Ω(n2) in the worst case.
![Page 85: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/85.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Space Consumption
Idea: Store only intersection points that are currently adjacent in T .
Obs.: At each point in time there are O(n) many such intersection points.
Procedure: If line segments loose their adjacency in T , removecorresponding intersection points in Q.
Q
![Page 86: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/86.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Space Consumption
Idea: Store only intersection points that are currently adjacent in T .
Obs.: At each point in time there are O(n) many such intersection points.
Procedure: If line segments loose their adjacency in T , removecorresponding intersection points in Q.
Q
![Page 87: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/87.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Space Consumption
Idea: Store only intersection points that are currently adjacent in T .
Obs.: At each point in time there are O(n) many such intersection points.
Procedure: If line segments loose their adjacency in T , removecorresponding intersection points in Q.
Q
![Page 88: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/88.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Space Consumption
Idea: Store only intersection points that are currently adjacent in T .
Obs.: At each point in time there are O(n) many such intersection points.
Procedure: If line segments loose their adjacency in T , removecorresponding intersection points in Q.
Q
![Page 89: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/89.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Space Consumption
Idea: Store only intersection points that are currently adjacent in T .
Obs.: At each point in time there are O(n) many such intersection points.
Procedure: If line segments loose their adjacency in T , removecorresponding intersection points in Q.
Q
![Page 90: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/90.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
Definition:
Set P with n points.Given:
![Page 91: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/91.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
P
p
Definition:
Set P with n points.Given:
![Page 92: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/92.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
P
p
Definition:
Set P with n points.Given:
![Page 93: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/93.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
P
p
Definition:
Set P with n points.Given:
![Page 94: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/94.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
P
p
Definition:
Set P with n points.Given:
![Page 95: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/95.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
P
p
a) Prove that the largest top-right region of a point is either a square orthe intersection of two open half-planes.
Definition:
Set P with n points.Given:
![Page 96: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/96.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
a) Prove that the largest top-right region of a point is either a square orthe intersection of two open half-planes.
b1) Which point in O1 ∩ P restricts the largesttop-right region of p the most?b2) Which point in O2 ∩ P restricts the largesttop-right region of p the most?
p
octant O2
octant O1
Definition:
Set P with n points.Given:
![Page 97: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/97.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
a) Prove that the largest top-right region of a point is either a square orthe intersection of two open half-planes.
b1) Which point in O1 ∩ P restricts the largesttop-right region of p the most?b2) Which point in O2 ∩ P restricts the largesttop-right region of p the most?
p
octant O2
octant O1
Definition:
t(p) ∈ P : Point in O1 with smallest vert.distance to p.
r(p) ∈ P : Point in O2 with smallest horz. distance to p.
Set P with n points.Given:
![Page 98: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/98.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
The largest top-right region of a point p ∈ P is the union of all openaxis-aligned squares that touch p with their bottom left corner andcontain no other point of P in their interior.
a) Prove that the largest top-right region of a point is either a square orthe intersection of two open half-planes.
b1) Which point in O1 ∩ P restricts the largesttop-right region of p the most?b2) Which point in O2 ∩ P restricts the largesttop-right region of p the most?
p
octant O2
octant O1
c) Largest top-right region for all points in O(n log n) running time.
Definition:
t(p) ∈ P : Point in O1 with smallest vert.distance to p.
r(p) ∈ P : Point in O2 with smallest horz. distance to p.
Set P with n points.Given:
![Page 99: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/99.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
Idea: Determine for each point p thepoint t(p) (and r(p))
Data structure:Binary search tree T over P , where point p ∈ T , if
1. p lies below the sweep-line2. t(p) has not been determined yet.
Sweepline: from bottom to top
Initially T is empty and points in T are sorted w.r.t. their x-coord.
Events: Points in P
Handling event p
2. Find point p′ ∈ T directly left to p:
If p lies in upper octant of p′ :
1. Insert p into T .
= contained in T
t(p′)← p, delete p′ from Trepeat step 2
![Page 100: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/100.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
Idea: Determine for each point p thepoint t(p) (and r(p))
Data structure:Binary search tree T over P , where point p ∈ T , if
1. p lies below the sweep-line2. t(p) has not been determined yet.
Sweepline: from bottom to top
Initially T is empty and points in T are sorted w.r.t. their x-coord.
Events: Points in P
Handling event p
2. Find point p′ ∈ T directly left to p:
If p lies in upper octant of p′ :
1. Insert p into T .
= contained in T
t(p′)← p, delete p′ from Trepeat step 2
![Page 101: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/101.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
Idea: Determine for each point p thepoint t(p) (and r(p))
Data structure:Binary search tree T over P , where point p ∈ T , if
1. p lies below the sweep-line2. t(p) has not been determined yet.
Sweepline: from bottom to top
Initially T is empty and points in T are sorted w.r.t. their x-coord.
Events: Points in P
Handling event p
2. Find point p′ ∈ T directly left to p:
If p lies in upper octant of p′ :
1. Insert p into T .
= contained in T
t(p′)← p, delete p′ from Trepeat step 2
![Page 102: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/102.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
Idea: Determine for each point p thepoint t(p) (and r(p))
Data structure:Binary search tree T over P , where point p ∈ T , if
1. p lies below the sweep-line2. t(p) has not been determined yet.
Sweepline: from bottom to top
Initially T is empty and points in T are sorted w.r.t. their x-coord.
Events: Points in P
Handling event p
2. Find point p′ ∈ T directly left to p:
If p lies in upper octant of p′ :
1. Insert p into T .
= contained in T
t(p′)← p, delete p′ from Trepeat step 2
![Page 103: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/103.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
Idea: Determine for each point p thepoint t(p) (and r(p))
Data structure:Binary search tree T over P , where point p ∈ T , if
1. p lies below the sweep-line2. t(p) has not been determined yet.
Sweepline: from bottom to top
Initially T is empty and points in T are sorted w.r.t. their x-coord.
Events: Points in P
Handling event p
2. Find point p′ ∈ T directly left to p:
If p lies in upper octant of p′ :
1. Insert p into T .
= contained in T
t(p′)← p, delete p′ from Trepeat step 2
![Page 104: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/104.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
Idea: Determine for each point p thepoint t(p) (and r(p))
Data structure:Binary search tree T over P , where point p ∈ T , if
1. p lies below the sweep-line2. t(p) has not been determined yet.
Sweepline: from bottom to top
Initially T is empty and points in T are sorted w.r.t. their x-coord.
Events: Points in P
Handling event p
2. Find point p′ ∈ T directly left to p:
If p lies in upper octant of p′ :
1. Insert p into T .
= contained in T
t(p′)← p, delete p′ from Trepeat step 2
![Page 105: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/105.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Largest Top-Right Region
Idea: Determine for each point p thepoint t(p) (and r(p))
Data structure:Binary search tree T over P , where point p ∈ T , if
1. p lies below the sweep-line2. t(p) has not been determined yet.
Sweepline: from bottom to top
Initially T is empty and points in T are sorted w.r.t. their x-coord.
Events: Points in P
Handling event p
2. Find point p′ ∈ T directly left to p:
If p lies in upper octant of p′ :
1. Insert p into T .
= contained in T
t(p′)← p, delete p′ from Trepeat step 2
![Page 106: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/106.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision of plane.
Quelle:Google
Earth
![Page 107: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/107.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision of plane.
Quelle:Google
Earth
![Page 108: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/108.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision of plane.
![Page 109: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/109.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision of plane.
![Page 110: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/110.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision of plane.
vertex
edge
face
polyline
![Page 111: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/111.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision of plane.
vertex
edge
face
polyline
Requirements:• Access to vertices, faces and edges.• Traversing of faces.• Traversing outgoing edges.
How to store subdivision efficiently?
![Page 112: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/112.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
f1
f2
f3
f4
![Page 113: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/113.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
For each edge of internal faces introduce directed half-edge (clockwise)
f1
f2
f3
f4
![Page 114: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/114.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
For each edge of internal faces introduce directed half-edge (clockwise)
For each edge of external face introduce directed half-edge (counter-clockw.)
f1
f2
f3
f4
![Page 115: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/115.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
Store for each face arbitrary adjacent half-edge.
edge(f1)
edge(f2)
edge(f3)
f1
f2
f3
f4
edge(f4)
![Page 116: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/116.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
Store for each face arbitrary adjacent half-edge.
edge(f1)
edge(f2)
edge(f3)
Store for each half-edge successor/predecessor, the half-edge on theopposite side, and the adjacent face.
e
next(e)
partner(e)
f1
f2
f3
f4
edge(f4)
prev(e)
face(e)
![Page 117: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/117.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
Store for each face arbitrary adjacent half-edge.
edge(f1)
edge(f2)
edge(f3)
Store for each half-edge successor/predecessor, the half-edge on theopposite side, and the adjacent face.
e
next(e)
partner(e)
edge(v)
v
Store for each vertex an arbitrary incident outgoing half-edge.
f1
f2
f3
f4
edge(f4)
prev(e)
face(e)
![Page 118: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/118.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
Store for each face arbitrary adjacent half-edge.
edge(f1)
edge(f2)
edge(f3)
Store for each half-edge successor/predecessor, the half-edge on theopposite side, and the adjacent face.
e
next(e)
partner(e)
edge(v)
v
Store for each vertex an arbitrary incident outgoing half-edge.
f1
f2
f3
f4
• Access vertices, faces and edges.• Traversing single faces.• Traversing outgoing edges of vertex.
edge(f4)
prev(e)
face(e)
![Page 119: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/119.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
Store for each face arbitrary adjacent half-edge.
edge(f1)
edge(f2)
edge(f3)
Store for each half-edge successor/predecessor, the half-edge on theopposite side, and the adjacent face.
e
next(e)
partner(e)
edge(v)
v
Store for each vertex an arbitrary incident outgoing half-edge.
f1
f2
f3
f4
• Access vertices, faces and edges.• Traversing single faces.• Traversing outgoing edges of vertex.
edge(f4)
prev(e)
face(e)
![Page 120: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/120.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
Store for each face arbitrary adjacent half-edge.
edge(f1)
edge(f2)
edge(f3)
Store for each half-edge successor/predecessor, the half-edge on theopposite side, and the adjacent face.
e
next(e)
partner(e)
edge(v)
v
Store for each vertex an arbitrary incident outgoing half-edge.
f1
f2
f3
f4
• Access vertices, faces and edges.• Traversing single faces.• Traversing outgoing edges of vertex.
edge(f4)
prev(e)
face(e)
![Page 121: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/121.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Subdivision
Store for each face arbitrary adjacent half-edge.
edge(f1)
edge(f2)
edge(f3)
Store for each half-edge successor/predecessor, the half-edge on theopposite side, and the adjacent face.
e
next(e)
partner(e)
edge(v)
v
Store for each vertex an arbitrary incident outgoing half-edge.
f1
f2
f3
f4
• Access vertices, faces and edges.• Traversing single faces.• Traversing outgoing edges of vertex.
edge(f4)
prev(e)
face(e)
![Page 122: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/122.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Traversing incident edges
v
e1e2
f2f1
g2g1
h2
h1
edge(v)
![Page 123: Convex Hull & Line Segment Intersection](https://reader034.vdocuments.mx/reader034/viewer/2022050415/6270ca964958ff5f9c28d611/html5/thumbnails/123.jpg)
Guido Bruckner · Computational Geometry – Problem Session
Traversing incident edges
v
e1e2
f2f1
g2g1
h2
h1
f2 = next(partner(e2))g2 = next(partner(f2))h2 = next(partner(g2))e2 = next(partner(h2))
Traversing in counter clockwise order.
edge(v)