Anda di halaman 1dari 26

# Straight Skeleton Implementation

Introduction Computation
 Convex polygon  Non-convex polygon  Polygon with holes

Complexity Reference

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.

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.

Introduction

## O.K. what is it good for?

Roof construction Image processing Offsetting Origami Geographic information systems

Computation

## Computing the straight skeleton

Intuition
 Roof construction  Shrinking process

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.

Computation

Computation

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

Vertex Node

Edge Face

Arc

10

## Computation Convex polygon

Convex polygon
Only Edge event Algorithm
1.

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 polygon

2.

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

13

## Computation Non-convex polygon

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

14

## 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

## Determine the coordinate of point B

B 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

## 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).

17

## 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.
18

## 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.

19

## Computation Non-convex polygon

Algorithm
1.

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 polygon

2.

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

21

## Polygon with holes

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

22

Complexity

complexity
Handling 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

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

## David Blanger, Designing Roofs of Buildings.

http://www.sable.mcgill.ca/~dbelan2/roofs/roofs.html

24

25

26