# straight skeleton implementation

Post on 07-Mar-2015

266 views

Embed Size (px)

TRANSCRIPT

Straight Skeleton Implementation

Introduction Computation Convex polygon Non-convex polygon Polygon with holes

Complexity Reference

2

Introduction

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.

3

Introduction

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 polygons vertices, as the edges of the polygon are propagating inwards at equal rate.

4

Introduction

O.K. what is it good for?Roof construction Image processing Offsetting Origami Geographic information systems

5

Computation

Computing the straight skeletonIntuition Roof construction Shrinking process

6

Computation

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.

7

Computation

8

Computation

Formal definitionThe 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).

9

Computation

Vertex Node

Edge Face

Arc

Straight skeleton s(P) Polygon P

10

Computation Convex polygon

Convex polygonOnly 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

11

Computation Convex polygon2.

While the queue is not empty a) 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 VnI Insert V to the LAV

f) Initialize V.

12

Computation Convex polygon

13

Computation Non-convex polygon

Non-convex polygonAn extension of the convex polygon algorithm. Edge event and Spilt event

14

Computation Non-convex polygon

A reflex vertex may lead into a Split even or an Edge event

An edge event (point A) and a split event (point B) due to a reflex vertex

15

Computation Non-convex polygon

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.

16

Computation Non-convex polygon

A simple intersection test is not enoughThe 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).

17

Computation Non-convex polygon

Managing of the LAVIn 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.18

Computation Non-convex polygon

Multiple split evensAn 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.

19

Computation Non-convex polygon

Algorithm1.

Initialization a) Create a LAV (same as in convex case). b) Compute the bisectors (same as in convex case). c) Compute the bisectors 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.

20

Computation Non-convex polygon2.

While the queue is not empty a) 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 V1nI, V2nI Search the opposite edge in LAVs Insert V1, V2 to the LAVs

f) Initialize V1 and V2.

21

Computation Polygon with holes

Polygon with holesThe algorithm can handle polygons with holes. Every hole represented by a LAV , in clockwise order.

22

Complexity

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)

23

Reference

ReferencesP. 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_skelet on_2/Chapter_main.html

David Blanger, Designing Roofs of Buildings.http://www.sable.mcgill.ca/~dbelan2/roofs/roofs.html

24

25

26