theory practice vs · 2016-07-01 · locate by walk talk outline basic incremental algorithm locate...
TRANSCRIPT
1
Delaunay triangulation,
Theory vs practice
Olivier Devillers
1
http://www.inria.fr/sophia/members/Olivier.Devillers/EuroCG2012/
Delaunay triangulation,
Theory vs practice
Bibliographical notes
[References, given in the abstract]
Benchmarks (src code)
2
Everybody in this room know what Delaunay is!
2
2
empty circle property
3
3
empty sphere property
4
A (partial) history of Delaunay algorithms(and of computational geometry)
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms [1970. . . ]
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms
Incremental
Gift wrapping
2D/3D
2D
[1970. . . ]
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms
Incremental
Gift wrapping
2D/3D
2D
Non optimal
”simple”
actually coded
linked to applications: meshes, reconstruction
[1970. . . ]
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms [1970. . . ]
Worst case algorithms [1980. . . ]
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms [1970. . . ]
Worst case algorithms [1980. . . ]
Divide & conquer
Plane sweep
2D
2D
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms
Non optimal
”simple”
actually coded
linked to applications: meshes, reconstruction
[1970. . . ]
Worst case algorithms [1980. . . ]
Divide & conquer
Plane sweep
2D
2D
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms [1970. . . ]
Worst case algorithms [1980. . . ]
Randomized algorithms [1990. . . ]
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms [1970. . . ]
Worst case algorithms [1980. . . ]
Randomized algorithms
Delaunay tree
Clarkson & Shor
Dynamic updates (history graph)
Delaunay hierarchy
Spatial sorting (BRIO)
[1990. . . ]
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms [1970. . . ]
Worst case algorithms [1980. . . ]
Randomized algorithms
[1995. . . ]Robustness issues
[1990. . . ]
4
A (partial) history of Delaunay algorithms(and of computational geometry)
Earlier algorithms [1970. . . ]
Worst case algorithms [1980. . . ]
Randomized algorithms
[1995. . . ]Robustness issues
[1990. . . ]
Properties checking
Exact computation paradigm
VRONI
TRIANGLE
5
Talk outline
5
Locate by walk
Talk outline
Basic incremental algorithm
Locate using randomized data structures
Vertex removal in 2D
Remarks on CGAL programming
Conclusion
One word on robustness issues
5
Locate by walk
Basic incremental algorithm
Locate using randomized data structures
Vertex removal in 2D
Remarks on CGAL programming
Conclusion
One word on robustness issues
6
One word on robustness issues
6
One word on robustness issues
The exact computation paradigm
6
One word on robustness issues
Compute predicates approximately
6
One word on robustness issues
Compute predicates approximately
Certify result
6
One word on robustness issues
Compute predicates approximately
Certify result
6
One word on robustness issues
Compute predicates approximately
Certify result
Run exact computation
6
One word on robustness issues
Compute predicates approximately
Certify result
Run exact computation
Extra cost
6
One word on robustness issues
Compute predicates approximately
Certify result
Extra cost
Delaunay 2D 10M points
Cartesian<double>
Exact predicates inexact constructions kernel
10.6 seconds
9.7 seconds
6
One word on robustness issues
Compute predicates approximately
Certify result
Extra cost
Delaunay 2D 10M points
Cartesian<double>
Exact predicates inexact constructions kernel
3D
10.6 seconds
9.7 seconds
82 seconds
75 seconds
6
One word on robustness issues
Compute predicates approximately
Certify result
Extra cost
Delaunay 2D 10M points
Cartesian<double>
Exact predicates inexact constructions kernel
3D
10.6 seconds
9.7 seconds
82 seconds
75 secondsmay loop (or crash)
6
One word on robustness issues
Compute predicates approximately
Certify result
Extra cost
Delaunay 2D 10M points
Cartesian<double>
Exact predicates inexact constructions kernel
3D
10.6 seconds
9.7 seconds
82 seconds
75 seconds
All benchmarks
2.3 GHz, 16 GByte workstation
Exact predicates inexact constructions kernel
3.9 (Release mode)
7
Locate by walk
Locate using randomized data structures
Vertex removal in 2D
Remarks on CGAL programming
Conclusion
One word on robustness issues
Basic incremental algorithm
8
Basic incremental algorithm
8
Basic incremental algorithm
Locate
8
Basic incremental algorithm
Find conflicts
8
Basic incremental algorithm
Remove triangles
8
Basic incremental algorithm
Fill the hole
9
Locate using randomized data structures
Vertex removal in 2DRemarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Straight walk
10
Locate by walk - straight walk
10
Locate by walk - straight walk
10
Locate by walk - straight walk
10
Locate by walk - straight walk
10
Locate by walk - straight walk
10
Locate by walk - straight walk
10
Exit edge ?One orientation predicate
10
Locate by walk - straight walk
Exit edge ?One orientation predicate
10
End of walk ?A second orientation predicate
10
Locate by walk - straight walk
End of walk ?A second orientation predicate
11
Locate using randomized data structures
Vertex removal in 2DRemarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Straight walkVisibility walk
12
Locate by walk - visibility walk
12
Locate by walk - visibility walk
12
Locate by walk - visibility walk
12
Locate by walk - visibility walk
12
Locate by walk - visibility walk
12
Locate by walk - visibility walk
12
Locate by walk - visibility walk
Triangle with two exitsOne orientation predicate
12
Locate by walk - visibility walk
Triangle with one exit1.5 orientation predicate
One predicate
Two predicates
if this neighbor tried first
if this neighbor tried first
12
Locate by walk - visibility walk
1.25 orientation predicate ?
13
Visibility vs straight walk
Locate by walk
13
Visibility vs straight walk
less predicates per crossed edge
similar number of crossed edges
2D and 3D
Locate by walk
experimental / theoretical
13
Visibility vs straight walk
Speed improvement ?
Locate by walk
13
Visibility vs straight walk
Speed improvement ?
Walk in Delaunay 1 Mpoints
Straight: 324 µs
Visibility: 285 µs
3D: 97 µs
Locate by walk
13
Visibility vs straight walk
Speed improvement ?
Much easier to code
Walk in Delaunay 1 Mpoints
Straight: 324 µs
Visibility: 285 µs
3D: 97 µs
Locate by walk
14
Locate using randomized data structures
Vertex removal in 2DRemarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Straight walkVisibility walkStructural filtering
15
Locate by visibility walk - structural filtering
15
Locate by visibility walk - structural filtering
15
Locate by visibility walk - structural filtering
Walk may loop (not in Delaunay)
15
Locate by visibility walk - structural filtering
Walk may loop (not in Delaunay)
Robustness issue:
Non certified arithmetic
Rounding errors
Wrong decisionsduring walk
15
Locate by visibility walk - structural filtering
Walk may loop (not in Delaunay)
Robustness issue:
even in Delaunay
may loop
15
Locate by visibility walk - structural filtering
Walk may loop (not in Delaunay)
Robustness issue:
even in Delaunay
But only in very
special configurations
may loop
15
Locate by visibility walk - structural filtering
Orientation predicates
Certify all along the walk
Certify after a while, just in case
285 µseconds
220 µseconds
15
Locate by visibility walk - structural filtering
Orientation predicates
Certify all along the walk
Certify after a while, just in case
285 µseconds
220 µseconds
97 µseconds
81 µseconds
2D 3D
Walk in Delaunay 1 Mpoints
16
Locate using randomized data structures
Vertex removal in 2DRemarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Straight walkVisibility walkStructural filteringWalk shape
17
Locate by visibility walk - walk shape
17
Locate by visibility walk - walk shape
Rightmost
17
Locate by visibility walk - walk shape
Leftmost
17
Locate by visibility walk - walk shape
In between
17
Locate by visibility walk - walk shape
18
Locate by visibility walk - walk shape
Turn counterclockwise from previous
Rightmost
1
2
18
Locate by visibility walk - walk shape
Leftmost
Turn clockwise from previous
1
2
18
Locate by visibility walk - walk shape
first with proba 13
first with proba 23
Balance left and right turns
18
Locate by visibility walk - walk shape
220 µseconds
Walk in Delaunay 1 Mpoints
Leftmost
188 µsecondsBalanced
19
Locate by visibility walk
220 µsecondsStructural filtering
188 µsecondsBalanced walk
Straight walk
Visibility walk
324 µseconds
285 µseconds
Walk in Delaunay 1 Mpoints
20
Vertex removal in 2DRemarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
21
Data structures to locate - the Delaunay tree
locate based on incircle predicate
] triangles in the Delaunay tree
21
Data structures to locate - the Delaunay tree
How many triangles created by the last point ?
21
Data structures to locate - the Delaunay tree
How many triangles created by the last point ?
21
Data structures to locate - the Delaunay tree
How many triangles created by the last point ?
21
Data structures to locate - the Delaunay tree
locate based on incircle predicate
] triangles in the Delaunay tree
= 6n (randomized)
22
Vertex removal in 2DRemarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Delaunay tree
Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
Nearest Neighbor
Query
23
Data structures to locate - the Delaunay hierarchy
Nearest Neighbor
Query
23
Data structures to locate - the Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
The Delaunay tree
locate based on incircle predicate
] triangles in the Delaunay tree
= 6n (randomized)
23
Data structures to locate - the Delaunay hierarchy
The Delaunay tree
locate based on incircle predicate
] triangles in the Delaunay tree
= 6n (randomized)
based on orientation predicate
] triangles in the hierarchy
= 1.03× 2n (expected)
can be chosen
The Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
The Delaunay tree
locate based on incircle predicate
] triangles in the Delaunay tree
= 6n (randomized)
based on orientation predicate
] triangles in the hierarchy
= 1.03× 2n (expected)
can be chosen
O(n log n)
The Delaunay hierarchy
23
Data structures to locate - the Delaunay hierarchy
The Delaunay tree
locate based on incircle predicate
] triangles in the Delaunay tree
= 6n (randomized)
based on orientation predicate
] triangles in the hierarchy
= 1.03× 2n (expected)
can be chosen
17 seconds2.3 seconds
50000 random points (original benchmarks in 2000).
The Delaunay hierarchy
24
Vertex removal in 2DRemarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Delaunay tree
Biased randomized insertion order
Delaunay hierarchy
25
Data structures to locate - biased random insertion order
25
Data structures to locate - biased random insertion order
Locate is easy if you know a vertex nearby
25
Data structures to locate - biased random insertion order
Locate is easy if you know a vertex nearby
Natural idea: sort the points, locate from previous
25
Data structures to locate - biased random insertion order
x-order
25
Data structures to locate - biased random insertion order
Hilbert order
25
Data structures to locate - biased random insertion order
Biased order (Spatial sorting)
25
Data structures to locate - biased random insertion order
Biased order (Spatial sorting)
25
Data structures to locate - biased random insertion order
Biased order (Spatial sorting)
25
Data structures to locate - biased random insertion order
random order
x-order
Hilbert order
Biased order (Spatial sorting)
locate using Delaunay hierarchy
0.7 seconds
157 seconds
3 seconds
0.8 seconds
6 seconds
Delaunay 2D 1M random points
25
Data structures to locate - biased random insertion order
random order
x-order
Hilbert order
Biased order (Spatial sorting)
locate using Delaunay hierarchy
Delaunay 2D 100K parabola points
128 seconds
632 seconds
46 seconds
0.3 seconds
0.3 seconds
26
10.6 secondsBiased random order
Delaunay tree
Delaunay hierarchy
∼ 10 mn (estimate)
90 seconds
Construction of Delaunay 10 M random points
Data structures to locate
27
Remarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Vertex removal in 2D
28
Vertex removal
28
Vertex removal
28
Vertex removal
28
Vertex removal
29
Remarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Vertex removal in 2D
Various algorithmsBoundary expansion
30
release 3.5, 2D implementation
Vertex removal - boundary expansion
30
release 3.5, 2D implementation
hole boundary = queue
Vertex removal - boundary expansion
30
release 3.5, 2D implementation
find new incident triangle in linear time
Vertex removal - boundary expansion
30
release 3.5, 2D implementation
Vertex removal - boundary expansion
30
release 3.5, 2D implementation
Vertex removal - boundary expansion
31
Remarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Vertex removal in 2D
Various algorithmsBoundary expansionTriangulate and sew
32
current 3D implementation
Vertex removal - triangulate and sew
32
current 3D implementation
Delaunay of neighbors
Vertex removal - triangulate and sew
32
current 3D implementation
delete extra triangles and sew
Vertex removal - triangulate and sew
32
current 3D implementation
delete extra triangles and sew
not implemented in 2D
Vertex removal - triangulate and sew
33
Remarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Vertex removal in 2D
Various algorithmsBoundary expansionTriangulate and sewFlip the hole
34
Vertex removal - flip the hole
34triangulate from any vertex
Vertex removal - flip the hole
34queue of edges to be checked
Vertex removal - flip the hole
34
Vertex removal - flip the hole
34
Vertex removal - flip the hole
34
Vertex removal - flip the hole
34
Vertex removal - flip the hole
34
Vertex removal - flip the hole
34
Vertex removal - flip the hole
34
a litle bit faster
Vertex removal - flip the hole
35
Remarks on CGAL programmingConclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Vertex removal in 2D
Various algorithms
Low degree optimization
36
degree 3
Vertex removal - low degree optimization
36
degree 3
almost nothing to do
Vertex removal - low degree optimization
37
degree 4
Vertex removal - low degree optimization
37
degree 4
just one incircle test to decide
Vertex removal - low degree optimization
38
degree 5
Vertex removal - low degree optimization
38
degree 5
”star” the pentagon from the right vertex
Vertex removal - low degree optimization
38
degree 5
”star” the pentagon from the right vertex
Vertex removal - low degree optimization
38
degree 5
”star” the pentagon from the right vertex
Vertex removal - low degree optimization
38
degree 5
”star” the pentagon from the right vertex
Vertex removal - low degree optimization
38
degree 5
”star” the pentagon from the right vertex
Vertex removal - low degree optimization
38
degree 5
”star” the pentagon from the right vertex
Vertex removal - low degree optimization
39
degree 5
Decision tree
Vertex removal - low degree optimization
39
degree 5
Decision tree3∈012
4∈0234∈013
yesno
4∈1234∈012
v0v2 v1
v3
v4v4
v0
v2v1
v3v4
Vertex removal - low degree optimization
40
degree 6
Vertex removal - low degree optimization
40
degree 6
Vertex removal - low degree optimization
40
degree 6
Vertex removal - low degree optimization
40
degree 6
Vertex removal - low degree optimization
40
degree 6
Vertex removal - low degree optimization
40
degree 6
Vertex removal - low degree optimization
40
degree 6
14 results
Vertex removal - low degree optimization
41
degree 6Decision tree
Vertex removal - low degree optimization
41
degree 6Decision tree
1∈230
4∈235
1∈2341∈235
4∈0135∈1241∈345star5
4∈0135∈013 5∈014antiN0N2
antiN0
5∈014
5∈014 star1N1star4 antiN1
star1N1
diamond1
4∈503
star3 antiN0
4∈235
4∈2305∈230
4∈012star05∈0124∈503
4∈1254∈502antiN2N0 star5star0
5∈012
diamond0
N2 4∈015
star2 star4N2 antiN1
v0
v1
v2v3
v5
v4
Vertex removal - low degree optimization
41
degree 6Decision tree
1∈230
4∈235
1∈2341∈235
4∈0135∈1241∈345star5
4∈0135∈013 5∈014antiN0N2
antiN0
5∈014
5∈014 star1N1star4 antiN1
star1N1
diamond1
4∈503
star3 antiN0
4∈235
4∈2305∈230
4∈012star05∈0124∈503
4∈1254∈502antiN2N0 star5star0
5∈012
diamond0
N2 4∈015
star2 star4N2 antiN1
v0
v1
v2v3
v5
v4
6 incircle predicates
Vertex removal - low degree optimization
42
symmetric tree
degree 7Decision tree
Vertex removal - low degree optimization
42
symmetric tree
degree 7Decision tree
10 incircle predicates
Vertex removal - low degree optimization
43
degree 3 4 5 6 7 8? 9] results 1 2 5 14 42 132 429] leaves 1 2 6 24 130 '500dlog2 ]resultse 0 1 3 4 6 8 9tree height 0 1 3 6 10 '14] lines of code 30 40 90 280 700 '2500? not implemented. The sizes of the tree and the code are estimated
Vertex removal - low degree optimization
44
Remarks on implementation
limited memory allocation, use old faces ”in place”
re-use as many neighbor links as possible
Vertex removal - low degree optimization
44
Remarks on implementation
limited memory allocation, use old faces ”in place”
re-use as many neighbor links as possible
tree implementationif incircle(...)
if incircle(...)
if incircle(...) use_this_shape(face0,face1,face2...)
else use_other_shape(face2,face3,face4...)
......
Vertex removal - low degree optimization
45
degree
small degrees
deletion time per vertex
3 4 5 6 7 8 9 10 11 ≥ 12
10µs
Vertex removal
Boundary expansionFlip the hole
45
degree
3.5
small degrees
deletion time per vertex
3 4 5 6 7 8 9 10 11 ≥ 12
10µs
Vertex removal
Boundary expansionFlip the hole
3.6
45
degreeinit (load memory)
3.5
small degrees
deletion time per vertex
3 4 5 6 7 8 9 10 11 ≥ 12
10µs
Vertex removal
Boundary expansionFlip the hole
3.6
45
degree
] points
30%
init (load memory)
3.5
small degrees
deletion time per vertex
degree distribution
3 4 5 6 7 8 9 10 11 ≥ 12
10µs
Vertex removal
Boundary expansionFlip the hole
3.6
46
Conclusion
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Vertex removal in 2D
Remarks on CGAL programming
47
Algorithmic choices
47
Algorithmic choices
Theoretical efficiency
47
Algorithmic choices
Theoretical efficiency
Practical efficiency
47
Algorithmic choices
Theoretical efficiency
Practical efficiency
Robustness issues
47
Algorithmic choices
Theoretical efficiency
Practical efficiency
Robustness issues
Modularitytraits classes
data structuresgeometry
47
Algorithmic choices
Theoretical efficiency
Practical efficiency
Robustness issues
Modularitytraits classes
data structuresgeometry
Minimal requirements
e.g. do not use strange predicates
48
Delaunay triangulation
Geometric traits Triangulation data structure
48
Delaunay triangulation
Geometric traits Triangulation data structureIR2
48
Delaunay triangulation
Geometric traits Triangulation data structure
IR3 projection
48
Delaunay triangulation
Geometric traits Triangulation data structure
IR2 other metric
48
Delaunay triangulation
Geometric traits Triangulation data structure
Periodic triangulation
49
' 1µs per point
50
' 8µs per point
51
One word on robustness issuesBasic incremental algorithm
Locate by walk
Locate using randomized data structures
Vertex removal in 2D
Remarks on CGAL programming
Conclusion
Delaunay challenges
52
Delaunay challenges
Practical vs worst case size of Delaunay 3D
52
Known results
Delaunay challenges
Practical vs worst case size of Delaunay 3D
Θ(n2) worst case
Θ(n) random in ball
Ω(n)O(n log n) random on polyhedron
O(n log n) good sample of smooth generic surface
Θ(n log n) random on cylinder
52
Known results
Delaunay challenges
Practical vs worst case size of Delaunay 3D
Θ(n2) worst case
Θ(n) random in ball
Ω(n)O(n log n) random on polyhedron
O(n log n) good sample of smooth generic surface
Θ(n log n) random on cylinder
Find good models of practical data
(Smooth analysis)
52
Delaunay challenges
Practical vs worst case size of Delaunay 3D
Better algorithm for 3D deletion
10 µs to insert
100 µs to delete
52
Delaunay challenges
Practical vs worst case size of Delaunay 3D
Better algorithm for 3D deletion
One billion points
Needs memory efficient algorithms
Cache effects are already important
53
Questions