110 likes | 348 Views
P. l. l-Monotone. C onvex polygons are easy to triangul ate . Unfortunately the partition into convex parts is just as difficult as the triangulation. l-monotone.
E N D
P l l-Monotone Convex polygons are easy to triangulate. Unfortunately the partition into convex parts is just as difficult as the triangulation. l-monotone 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 Geometry Prof. Dr. Th. Ottmann
Two steps for triangulation 1. Divide P into y-monotone parts P1,...,Pk 2. Triangulate P1,...,Pk Computational Geometry Prof. Dr. Th. Ottmann
Split and Merge Vertices = start vertex = end vertex = regular vertex = split vertex = merge vertex Computational Geometry Prof. Dr. Th. Ottmann
Five Types of Vertices • = start vertex • = end vertex • = regular vertex • = split vertex • = merge vertex Computational Geometry Prof. Dr. Th. Ottmann
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 Geometry Prof. Dr. Th. Ottmann
Idea: Fan so long build to convexity hurts alternation from right and left side Triangulation of y-monotone Polygon Implementation: Scan-line uses stack as data structure Case 1: Page overflows Case 2: resembles page not yet triangulated popped pushed Computational Geometry Prof. Dr. Th. Ottmann
a b Example c d e Batches : ba c : ba ca d : ca dc e : dc ed g f h i j k l m n o p r q t u s v w x Computational Geometry Prof. Dr. Th. Ottmann
a b c d e f g h i j Computational Geometry Prof. Dr. Th. Ottmann
Implementation • S.push(u1), S.push(u2) • 2. for j = 3,...,n-1 • 3. 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. else • 8. while (diag(S.top, uj) in P) • 9. diag(S.top, uj) • 10. S.pop • 11. S.push(last) • 12. S.push(uj) uj uj Theorem: time O(n) Proof: number of pops < number of pushes Computational Geometry Prof. Dr. Th. Ottmann
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 Geometry Prof. Dr. Th. Ottmann
Computational Geometry Algorithms Library http://www.cs.uu.nl/CGAL Kernel 2D/3D point, vector, direction, segment, ray, line, dD point, triangle, bounding box,iso-rectangle, circle, plane, tetrahedron, predicates, affine transformations, intersectionand distance calculation Basic Library half edge data structure, topological map, planar map,polyhedron, Boolean operationson 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 Computational Geometry Prof. Dr. Th. Ottmann