straight skeleton implementation
Post on 07-Mar-2015
312 Views
Preview:
TRANSCRIPT
Straight Skeleton Implementation
2
IntroductionComputation
Convex polygonNon-convex polygonPolygon with holes
Complexity Reference
3
A skeleton of a polygon is a partition of the polygon into regions, creating internal vertices, edges and faces.
There are two main types of skeletons: The Medial Axis and the Straight skeleton.
Introduction
4
The Medial axis is the locus of the centers of all circles that are tangent to the polygon at two or more points.
The Straight Skeleton is the trace of the polygon’s vertices, as the edges of the polygon are propagating inwards at equal rate.
Introduction
5
O.K. what is it good for?Roof constructionImage processingOffsettingOrigamiGeographic information systems
Introduction
6
Computing the straight skeletonIntuition
Roof construction Shrinking process
Computation
7
Shrinkage As the edges of the polygon are moving inwards at equal
rate, the vertices move along the bisector of its two adjacent edges.
Two possible events may occur :Edge Event –An edge shrinks to zero.Split Event – A reflex vertex hits an opposite
edge, splitting the polygon into two disconnected parts.
Computation
8
Computation
9
Formal definition The straight skeleton, S(P), of polygon P is the union
of the pieces of the angular bisectors traced out by the polygon vertices during the shrinking process.
Each edge, e, sweeps out a certain area called the face of e.
Bisector pieces are called arcs, and their endpoints which are not vertices of P are called nodes of S(P).
Computation
10
Computation
Polygon P
Straight skeleton s(P)
Face
Edge
Arc
Node
Vertex
11
Convex polygon Only Edge event
Algorithm1. Initialization
a) Create a circular double connected list of active vertices (LAV) of the polygon (counter-clockwise).
b) For every vertex add pointers to the edges creating it and compute the bisector.
c) Compute the nearer intersection point of every set of adjacent bisectors and store them in to a priority queue according to their distance from the edges
Computation – Convex polygon
12
2. While the queue is not emptya) Pop the next intersection point I.b) If the vertices/nodes Va, Vb pointed by I are marked, go to 2.a
else – Edge event.c) If the predecessor of the predecessor of Va is Vb – output VaI,
VbI, VcI. Vc - predecessor of Va.d) Output VaI, VbI.e) Update the LAV:• Mark Va, Vb
• Create new node VI• Insert V to the LAV
f) Initialize V.
Computation – Convex polygon
13
Computation – Convex polygon
14
Non-convex polygonAn extension of the convex polygon algorithm.Edge event and Spilt event
Computation – Non-convex polygon
15
A reflex vertex may lead into a Split even or an Edge event
Computation – Non-convex polygon
An edge event (point A) and a split event (point B) due to a reflex vertex
16
Determine the coordinate of point BB is equidistant from the edges adjacent to the
reflex vertex, and from the “opposite” edge.For every reflex vertex, we traverse all the edges
in the original polygon and test them whether they can be the “opposite” edge.
Computation – Non-convex polygon
17
A simple intersection test is not enough The intersection point between the reflex vertex and the
line supporting the opposite edges must be in the area defined between the edge and the bisectors of its two vertices.
The intersection point is the meeting point of the three bisectors between all three participating edges (the two defining the reflex vertex and the split edge).
Computation – Non-convex polygon
18
Managing of the LAV In a split event the LAV split into two LAVs. The splitting
vertex is replaced with two new vertices, one in each LAV.
New bisectors and edge events are calculated for each of these vertices.
Computation – Non-convex polygon
19
Multiple split evens An edge can be split more then once. In a split event we must correctly choose the end point of
the edge. It is handled during the LAVs traversal.
Computation – Non-convex polygon
20
Algorithm1. Initialization
a) Create a LAV (same as in convex case).b) Compute the bisectors (same as in convex case).c) Compute the bisector’s intersections and for reflex vertices
compute also intersection with “opposite” edge. store them in to a priority queue according to their distance from the edges and store the type of intersection.
Computation – Non-convex polygon
21
2. While the queue is not emptya) Pop the next intersection point I. if I is an edge event, do steps
2.b to 2.f of the convex case. Else continue. b) If I points to marked vertices, go to 2.a.c) same as in convex case (local roof peaks).d) Output VI, where V is the vetex/node pointed by I.e) Update the LAVs:• Mark V• Create two new nodes V1I, V2I• Search the opposite edge in LAVs• Insert V1, V2 to the LAVs
f) Initialize V1 and V2.
Computation – Non-convex polygon
22
Polygon with holes The algorithm can handle polygons with holes. Every hole represented by a LAV , in clockwise order.
Computation – Polygon with holes
23
complexityHandling edge event- O(1)Handling split event- O(nm) n- number of vertices, m- number of reflex vertices
Handling the priority queue- O(nlogn)
Total running time: O(nm+nlogn)
Complexity
24
References P. Felkel, S. Obdrzalek, Straight Skeleton Implementation,
Spring Conference on Computer Graphics, Budmerice, Slovakia, pages 210-218.
Computational Geometry Algorithms Library (CGAL), CGAL User and Reference Manual, Chapter 23- 2D Straight Skeleton and Polygon Offsetting. http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Straight_skeleton_2/Chapter_main.html
David B’langer, Designing Roofs of Buildings. http://www.sable.mcgill.ca/~dbelan2/roofs/roofs.html
Reference
25
26
top related