Computational Geometry – Problem Session Convex Hull & Line Segment Intersection

Computational Geometry – Problem Session Convex Hull & Line Segment Intersection

Computational Geometry { Problem Session Convex Hull & Line Segment Intersection LEHRSTUHL FUR¨ ALGORITHMIK · INSTITUT FUR¨ THEORETISCHE INFORMATIK · FAKULTAT¨ FUR¨ INFORMATIK Guido Bruckner¨ 04.05.2018 Guido Bruckner¨ · Computational Geometry { Problem Session Modus Operandi To register for the oral exam we expect you to present an original solution for at least one problem in the exercise session. • this is about working together • don't worry if your idea doesn't work! Guido Bruckner¨ · Computational Geometry { Problem Session Outline Convex Hull Line Segment Intersection Guido Bruckner¨ · Computational Geometry { Problem Session Definition of Convex Hull Def: A region S ⊆ R2 is called convex, when for two points p; q 2 S then line pq 2 S. The convex hull CH(S) of S is the smallest convex region containing S. Guido Bruckner¨ · Computational Geometry { Problem Session Definition of Convex Hull Def: A region S ⊆ R2 is called convex, when for two points p; q 2 S then line pq 2 S. The convex hull CH(S) of S is the smallest convex region containing S. Guido Bruckner¨ · Computational Geometry { Problem Session Definition of Convex Hull Def: A region S ⊆ R2 is called convex, when for two points p; q 2 S then line pq 2 S. The convex hull CH(S) of S is the smallest convex region containing S. In physics: Guido Bruckner¨ · Computational Geometry { Problem Session Definition of Convex Hull Def: A region S ⊆ R2 is called convex, when for two points p; q 2 S then line pq 2 S. The convex hull CH(S) of S is the smallest convex region containing S. In physics: • put a large rubber band around all points Guido Bruckner¨ · Computational Geometry { Problem Session Definition of Convex Hull Def: A region S ⊆ R2 is called convex, when for two points p; q 2 S then line pq 2 S. The convex hull CH(S) of S is the smallest convex region containing S. In physics: • put a large rubber band around all points • and let it go! Guido Bruckner¨ · Computational Geometry { Problem Session Definition of Convex Hull Def: A region S ⊆ R2 is called convex, when for two points p; q 2 S then line pq 2 S. The convex hull CH(S) of S is the smallest convex region containing S. In physics: • put a large rubber band around all points • and let it go! • unfortunately, does not help algorithmically Guido Bruckner¨ · Computational Geometry { Problem Session Definition of Convex Hull Def: A region S ⊆ R2 is called convex, when for two points p; q 2 S then line pq 2 S. The convex hull CH(S) of S is the smallest convex region 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 C⊇S : C convex • does not help :-( Guido Bruckner¨ · Computational Geometry { Problem Session Algorithmic Approach Lemma: For a set of points P ⊆ R2, CH(P ) is a convex polygon that contains P and whose vertices are in P . Guido Bruckner¨ · Computational Geometry { Problem Session Algorithmic Approach Lemma: For a set of points P ⊆ R2, CH(P ) is a convex polygon that contains P and whose vertices are in P . Input: A set of points P = fp1; : : : ; png Output: List of nodes of CH(P ) in clockwise order Guido Bruckner¨ · Computational Geometry { Problem Session Algorithmic Approach −!pq Lemma: p q For a set of points P ⊆ R2, CH(P ) is a convex polygon that contains P and whose vertices are in P . Input: A set of points P = fp1; : : : ; png Output: List of nodes of CH(P ) in clockwise order Observation: (p; q) is an edge of CH(P ) , each point r 2 P n fp; qg • strictly right of the oriented line −!pq or • on the line segment pq Guido Bruckner¨ · Computational Geometry { Problem Session Running Time Analysis FirstConvexHull(P ) E ; foreach (p; q) 2 P × P with p 6= q do (n2 − n)· valid true foreach r 2 P do ) if not (r is strictly right of −!pq or r 2 pq) then ) 3 n n valid false Θ(1) Θ( Θ( if valid then E E [ f(p; q)g construct the sorted node list L from CH(P ) out of E return L Question: How do we implement this? Guido Bruckner¨ · Computational Geometry { Problem Session Solution Set of edges. Guido Bruckner¨ · Computational Geometry { Problem Session Solution Set of edges. Sort from left to right? w.r.t. source vertex Edges that point to the right or to the top. Sort from right to left? w.r.t. source vertex Edges that point to the left or to the bottom. Guido Bruckner¨ · Computational Geometry { Problem Session Solution Set of edges. Sort from left to right? w.r.t. source vertex Edges that point to the right or to the top. ?if not unique: Sort from right to left? from bottom to top. w.r.t. source vertex from top to bottom. Edges that point to the left or to the bottom. Guido Bruckner¨ · Computational Geometry { Problem Session Solution Set of edges. Sort from left to right? w.r.t. source vertex Edges that point to the right or to the top. ?if not unique: Sort from right to left? from bottom to top. w.r.t. source vertex from top to bottom. Edges that point to the left or to the bottom. Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) p1 Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) p1 Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) p1 Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) p1 Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) p1 Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) p1 Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) p1 Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order. GiftWrapping(P ) p1 = (x1; y1) rightmost point in P ; p0 (x1; 1); j 1 while true do pj+1 arg maxf\pj−1; pj; q j q 2 P n fpj−1; pjgg if pj+1 = p1 then break else j j + 1 return (p1; : : : ; pj+1) p1 p2 Guido Bruckner¨ · Computational Geometry { Problem Session Alternative: Gift Wrapping Idea: Begin with a point p1 of CH(P ), then find the next edge of CH(P ) in clockwise order.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    123 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us