400 likes | 591 Views
Convex Hulls. Computational Geometry, WS 2007/08 Lecture 2 – Supplementary Prof. Dr. Thomas Ottmann. Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg. Area of Triangle. Underlying idea:
E N D
Convex Hulls Computational Geometry, WS 2007/08 Lecture 2 – Supplementary Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg
Area of Triangle • Underlying idea: • For every edge, compute between it and a given line (or point). • Sum the area in a predetermined order. • Generalizable for any polygon. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Area of Triangle • Use x-axis line as reference. • Compute in clockwise order. (x1,y1) (x0,y0) (x2,y2) Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Area of Triangle ½ (x1 – x0 )(y0 + y1 ) (x1,y1) (x0,y0) (x2,y2) Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Area of Triangle ½ (x1 – x0 )(y0 + y1 ) + ½ (x2 – x1 )(y1 + y2 ) (x1,y1) (x0,y0) (x2,y2) Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Area of Triangle ½ (x1 – x0 )(y0 + y1 ) + ½ (x2 – x1 )(y1 + y2 ) + ½ (x0 – x2 )(y2 + y0 ) (x1,y1) (x0,y0) (x2,y2) Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Area of Triangle ½ (x1 – x0 )(y0 + y1 ) + ½ (x2 – x1 )(y1 + y2 ) + ½ (x0 – x2 )(y2 + y0 ) (x1,y1) (x0,y0) (x2,y2) = ½ [(x1 – x0 )(y0 + y1 ) + (x2 – x1 )(y1 + y2 ) + (x0 – x2 )(y2 + y0 )] = ½ [ x1y0 + x1y1 – x0y0 – x0y1 +x2y1 + x2y2 – x1y1 – x1y2 + x0y2 + x0y0 – x2y2 – x2y0 ] = ½ [ x1y0 + x2y1 + x0y2 – x0y1 – x1y2 – x2y0 ] Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Area of Triangle (x1,y1) (x0,y0) (x2,y2) | x0 y0 1 | | x1 y1 1 | | x2 y2 1 | Area of triangle = ½ Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Split set into two, compute convex hull of both, combine. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (i) Find the lower tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (ii) Find the upper tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (ii) Find the upper tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (ii) Find the upper tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (ii) Find the upper tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (ii) Find the upper tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (ii) Find the upper tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (ii) Find the upper tangent. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann
Convex Hull – Divide & Conquer • Merging two convex hulls: (iii) Eliminate non-hull edges. Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann