computing straight skeletons...computing straight skeletons by means of kinetic triangulations 1...
TRANSCRIPT
COMPUTING
STRAIGHT SKELETONS
BY MEANS OF
KINETIC TRIANGULATIONS
Peter Palfrader
October 2013
1
COMPUTING STRAIGHT SKELETONS
BY MEANS OF KINETIC TRIANGULATIONS
1 INTRODUCTIONDefinitionApplications
2 TRIANGULATION-BASED ALGORITHMBasic IdeaFlaws of the original AlgorithmExperimental Results
2
STRAIGHT SKELETONS
pferd11cm0.722
• Aichholzer, Alberts, Aurenhammer, Gärtner 1995.• Problem: Given input graph, find the straight skeleton.
3
STRAIGHT SKELETONS
• Aichholzer, Alberts, Aurenhammer, Gärtner 1995.• Problem: Given input graph, find the straight skeleton.
3
STRAIGHT SKELETONS – MOTIVATION
• input polygon P emanates wavefront WF(P, t).
• wavefront propagation — shrinking process.• straight skeleton SK(P) is traces of wavefront vertices.
4
STRAIGHT SKELETONS – MOTIVATION
• input polygon P emanates wavefront WF(P, t).• wavefront propagation — shrinking process.
• straight skeleton SK(P) is traces of wavefront vertices.
4
STRAIGHT SKELETONS – MOTIVATION
• input polygon P emanates wavefront WF(P, t).• wavefront propagation — shrinking process.
• straight skeleton SK(P) is traces of wavefront vertices.
4
STRAIGHT SKELETONS – MOTIVATION
• input polygon P emanates wavefront WF(P, t).• wavefront propagation — shrinking process.
• straight skeleton SK(P) is traces of wavefront vertices.
4
STRAIGHT SKELETONS – MOTIVATION
• input polygon P emanates wavefront WF(P, t).• wavefront propagation — shrinking process.
• straight skeleton SK(P) is traces of wavefront vertices.
4
STRAIGHT SKELETONS – MOTIVATION
• input polygon P emanates wavefront WF(P, t).• wavefront propagation — shrinking process.
• straight skeleton SK(P) is traces of wavefront vertices.
4
STRAIGHT SKELETONS – MOTIVATION
• input polygon P emanates wavefront WF(P, t).• wavefront propagation — shrinking process.
• straight skeleton SK(P) is traces of wavefront vertices.
4
STRAIGHT SKELETONS – MOTIVATION
• input polygon P emanates wavefront WF(P, t).• wavefront propagation — shrinking process.• straight skeleton SK(P) is traces of wavefront vertices.
4
TOPOLGY CHANGES – EDGE- AND SPLIT-EVENTS
• Wavefront topology changes over time.
• edge event: an edge of WF(P, t) vanishes.• split event: wavefront splits into two parts.• In SK(P), events (topology changes) are witnessed by
nodes.
5
TOPOLGY CHANGES – EDGE- AND SPLIT-EVENTS
• Wavefront topology changes over time.
• edge event: an edge of WF(P, t) vanishes.• split event: wavefront splits into two parts.• In SK(P), events (topology changes) are witnessed by
nodes.
5
TOPOLGY CHANGES – EDGE- AND SPLIT-EVENTS
• Wavefront topology changes over time.
• edge event: an edge of WF(P, t) vanishes.• split event: wavefront splits into two parts.• In SK(P), events (topology changes) are witnessed by
nodes.
5
TOPOLGY CHANGES – EDGE- AND SPLIT-EVENTS
edge events
• Wavefront topology changes over time.• edge event: an edge of WF(P, t) vanishes.
• split event: wavefront splits into two parts.• In SK(P), events (topology changes) are witnessed by
nodes.
5
TOPOLGY CHANGES – EDGE- AND SPLIT-EVENTS
• Wavefront topology changes over time.• edge event: an edge of WF(P, t) vanishes.
• split event: wavefront splits into two parts.• In SK(P), events (topology changes) are witnessed by
nodes.
5
TOPOLGY CHANGES – EDGE- AND SPLIT-EVENTS
split event
• Wavefront topology changes over time.• edge event: an edge of WF(P, t) vanishes.• split event: wavefront splits into two parts.
• In SK(P), events (topology changes) are witnessed bynodes.
5
TOPOLGY CHANGES – EDGE- AND SPLIT-EVENTS
split eventedge events
• Wavefront topology changes over time.• edge event: an edge of WF(P, t) vanishes.• split event: wavefront splits into two parts.• In SK(P), events (topology changes) are witnessed by
nodes.
5
APPLICATIONS: ROOF MODELING
image credit: Stefan Huber
6
APPLICATIONS: OFFSETTING
7
APPLICATIONS: OFFSETTING
7
APPLICATIONS: OFFSETTING
7
COMPUTING THE STRAIGHT SKELETON
• Common approach: simulate the wavefront propagation.
• Problem: When will the next event happen, and what is it?
• If we solve this, we can incrementally construct the SK.
8
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.
• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.
• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.
• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.
• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Aichholzer, Aurenhammer 1996, 1998.• Maintain a kinetic triangulation of the points of the plane
not yet visited.• Collapsing triangles witness edge and split events.
• Compute collapse times of triangles.• Maintain a priority queue of collapses.• On events, update triangulation and priority queue as
required.
• We can always easily find the next event, and thuscompute the straight skeleton.
9
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.• Instead they need special processing: flip events.
10
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.• Instead they need special processing: flip events.
10
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.• Instead they need special processing: flip events.
10
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.
• Instead they need special processing: flip events.
10
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.• Instead they need special processing: flip events.
10
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.• Instead they need special processing: flip events.
10
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.• Instead they need special processing: flip events.
10
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.• Instead they need special processing: flip events.
10
TRIANGULATION-BASED ALGORITHM
• Caveat: Not all collapses witness changes in the wavefronttopology.
• Such collapses cannot be ignored.• Instead they need special processing: flip events.
10
CONTRIBUTION
• We have implemented this algorithm.• We filled in gaps in the description of the algorithm.• The algorithm does not always work when input is not in
general position. We have identified and corrected theseflaws.
• We have run extensive tests using this code.
11
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
FLIP-EVENT LOOPS
• Without general position, this algorithm can end up ininfinite loops.
• This is not a result of inexact floating point operations. Thesame can happen with exact arithmetic!
12
DETECTING FLIP-EVENT LOOPS
• Keep a history of flip events 〈e1,e2, . . .〉 where eachei = (ti ,∆i).
• This history can be cleared when we encounter an edge orsplit event.
• If we encounter a flip event a second time, we may be in aflip-event loop.
13
HANDLING FLIP-EVENT LOOPS
Brief outline:• Identify the polygon P which has collapsed to a straight
line.• Retriangulate P and its neighborhood.
v1 vk
v3
v2 v4 v5
e
ve
C(e)
∆e
• This approach also is applicable to kinetic triangulations inother algorithms.
14
NUMBER OF FLIP EVENTS
• O(n3) is the best known upper bound on the number of flipevents,
• No input is known that results in more than quadraticallymany flip events.
• It turns out that for practical data the number of flip eventsis very linear.
15
NUMBER OF FLIP EVENTS, II
102 103 104 105 106
input size (number of vertices)
0
1
2
3
flips
/num
v
16
PERFORMANCE OBSERVATIONS
theoretical worst case practical
runtime space runtime space
E&E1 O(n17/11+ε) O(n17/11+ε) N/A
CGAL2 O(n2 log n) O(n2) O(n2 log n) O(n2)
Bone3 O(n2 log n) O(n) O(n log n) O(n)
Surfer4 O(n3 log n) O(n) O(n log n) O(n)
1Eppstein and Erickson, 19992F. Cacciola, 20043Huber and Held, 20104this, based on Aichholzer and Aurenhammer, 1998
17
RUNTIME TESTS
0.01
0.1
1
10
100
1000
103 104 105 106
runtime(seconds)
Surfer
BoneCGAL
10MB
100MB
1GB
103 104 105 106
mem
oryusage
Surfer
BoneCGAL
Runtime and memory usage behavior of CGAL, Bone, andSurfer for inputs of different sizes.Bone and Surfer use their IEEE 754 double precision backend.
18
SUMMARY
• We have implemented Aichholzer and Aurenhammer’salgorithm from 1998, filling in details in the algorithmdescription.
• We fixed real problems that arise in the absence of generalposition.
• Our approach to handling flip events has widerapplications.
• The implementation runs in O(n log n) time for real-worlddata. The number of flip events is linear in practice.
• It is industrial-strength, having been tested on tens ofthousands of inputs.
• It is the fastest straight skeleton construction code to date,handling millions of vertices in mere seconds.
19
QUESTIONS
Thank you for your attention.
Questions
20
GALLERY: BORDERS OF AUSTRIA
21
GALLERY: RANDOM POLYGON
22
GALLERY: PCB
23
GALLERY: POLYGON WITH HOLE
24
GALLERY: CIRCULAR HOLES
25
GALLERY: MORE HOLES
26
GALLERY: ALMOST POLYGON
27
GALLERY: STAR
28
GALLERY: SPIRALS
29
APPLICATIONS: GIS
image credit: Stefan Huber
30
PSLG
31
MEDIAL AXIS VS. SK
VD-based MA SK
32
ALTERNATE COMPUTATION
v
e
∆
2.5 3.0time
−1
0
1
2
f(ti
me)
∆ collapses
33
INFINITELY FAST VERTICES
v1
v2
∆1
∆2
e1
e2
w2
w1
34
TRIANGULATING
• Triangulate the convex hull.• Unfortunately the convex hull changes with time, and it
matters.
• We need to update the triangulation at some point beforethis happens, but how?
35
TRIANGULATING
• Triangulate the convex hull.• Unfortunately the convex hull changes with time, and it
matters.
• We need to update the triangulation at some point beforethis happens, but how?
35
TRIANGULATING
• Triangulate the convex hull.• Unfortunately the convex hull changes with time, and it
matters.
• We need to update the triangulation at some point beforethis happens, but how?
35
TRIANGULATING
• Triangulate the convex hull.• Unfortunately the convex hull changes with time, and it
matters.
• We need to update the triangulation at some point beforethis happens, but how?
35
TRIANGULATING
• Triangulate the convex hull.• Unfortunately the convex hull changes with time, and it
matters.
• We need to update the triangulation at some point beforethis happens, but how?
35
TRIANGULATING
• Triangulate the convex hull.• Unfortunately the convex hull changes with time, and it
matters.
• We need to update the triangulation at some point beforethis happens, but how?
35
TRIANGULATING
• Triangulate the convex hull.• Unfortunately the convex hull changes with time, and it
matters.
• We need to update the triangulation at some point beforethis happens, but how?
35
Ω FOR FLIP EVENTS
N1N2
. . .Nm
E1E2 . . .
Ek
E1 E2
W
36
Ω FOR NON-FLIP EVENTS
S(P)
P
Ω(n) edge events
Ω(n) triangles
e1e2
ek. . .
37
SOLUTION FOR FLIP-EVENT LOOPS WITH EGC
Pick, in order:• non-flip event → reduces triangles• longest edge to flip → reduces longest edge (count or
length)
38
AFFECTED TRIANGLES, MAX
102 103 104 105 106
input size (number of vertices)
100
101
102
103
104
affe
cted
tria
ngle
s
in edge events
102 103 104 105 106
input size (number of vertices)
100
101
102
103
104
affe
cted
tria
ngle
sin split events
39
AFFECTED TRIANGLES, AVG
102 103 104 105 106
input size (number of vertices)
10−1
100
101
102
affe
cted
∆/e
vent
40
TIME SPENT, PHASES
pre-processing
triangulation
kinetictria
ngulation
initial schedule
propagation process
post-processin
g0 %
20 %
40 %
60 %
80 %
100 %
runt
ime
(per
cent
age
ofto
tal)
41
MPFR
0 1000 2000 3000 4000 5000MPFR precision (bits)
0
50
100
150
Slow
dow
nfa
ctor
slowdown
0 1000 2000 3000 4000 5000MPFR precision (bits)
0
10
20
30
40
Blow
upfa
ctor
blowup
42