You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,8 @@ p4 = [-1.0, 2.0]
38
38
p5 = [4.0, 2.0]
39
39
p6 = [-2.0, -1.0]
40
40
pts = [p1, p2, p3, p4, p5, p6]
41
-
T, adj, adj2v, DG, HG =triangulate_berg(pts)
41
+
tri, HG =triangulate_berg(pts)
42
+
T, adj, adj2v, DG = tri # tri is a Triangulation struct, see ?Triangulation
42
43
```
43
44
This function `triangulate_berg` creates the triangulation for the given `pts`, returning:
44
45
-`T`: This is the set of triangles, of default type `Set{NTuple{3, Int64}}`. By default, triangles are represented as tuples of indices `(i, j, k)` so that `(pts[i], pts[j], pts[k])` are the points representing the triangle. All triangles `T` are positively oriented.
Copy file name to clipboardExpand all lines: src/bowyerwatson.jl
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,7 @@ end
56
56
randomise=true,
57
57
trim=true,
58
58
try_last_inserted_point=true,
59
+
trim_empty_features=true,
59
60
skip_pts=Set{Int64}())
60
61
61
62
Triangulates the set of points `pts` using the Bowyer-Watson algorithm.
@@ -72,13 +73,17 @@ Triangulates the set of points `pts` using the Bowyer-Watson algorithm.
72
73
- `randomise=true`: Whether to randomise the insertion order.
73
74
- `trim=true`: Whether to remove the ghost triangles at the end.
74
75
- `try_last_inserted_point=true`: At each stage, this should be `true` if the point that was last inserted should also be tried for initialising [`jump_and_march`](@ref).
76
+
- `trim_empty_features = true`: Whether to remove keys from the `Adjacent` map that refer to deleted edges, and edges from the `DelaunayGraph` that refer to deleted edges.
75
77
- `skip_pts`: There may be points you want to avoid adding into the triangulation, but they still exist in `pts`. If this is the case, add the indices for the points into a `Set` and set this keyword to this set.
76
78
77
79
# Outputs
80
+
The output is a `Triangulation` struct, containing
81
+
78
82
- `T`: The set of triangles.
79
83
- `adj`: The [`Adjacent`](@ref) map.
80
84
- `adj2v`: The [`Adjacent2Vertex`](@ref) map.
81
85
- `DG`: The `[DelaunayGraph`](@ref).
86
+
- `pts`: The provided point set.
82
87
"""
83
88
functiontriangulate_bowyer(pts;
84
89
IntegerType::Type{I}=Int64,
@@ -124,7 +129,7 @@ function triangulate_bowyer(pts;
Copy file name to clipboardExpand all lines: src/deberg.jl
+40-1Lines changed: 40 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,45 @@ function add_point_berg!(T, adj::Adjacent{I,E}, adj2v, DG, HG::HistoryGraph{Tri}
23
23
returnnothing
24
24
end
25
25
26
+
"""
27
+
triangulate_berg(pts;
28
+
IntegerType::Type{I}=Int64,
29
+
EdgeType::Type{E}=NTuple{2,IntegerType},
30
+
TriangleType::Type{V}=NTuple{3,IntegerType},
31
+
EdgesType::Type{Es}=Set{EdgeType},
32
+
TrianglesType::Type{Ts}=Set{TriangleType},
33
+
randomise=true,
34
+
trim=true,
35
+
trim_empty_features=true,
36
+
skip_pts=Set{Int64}()) where {I,E,V,Es,Ts}
37
+
38
+
Triangulates the set of points `pts` using the de Berg's algorithm.
39
+
40
+
# Inputs
41
+
- `pts`: The point set.
42
+
43
+
# Keyword Arguments
44
+
- `IntegerType::Type{I}=Int64`: Type used to represent integers.
45
+
- `EdgeType::Type{E}=NTuple{2,IntegerType}`: Type used to represent edges.
46
+
- `TriangleType::Type{V}=NTuple{3,IntegerType}`: Type used to represent triangles.
47
+
- `EdgesType::Type{Es}=Set{EdgeType}`: Type used to represent a collection of edges.
48
+
- `TrianglesType::Type{Ts}=Set{TriangleType}`: Type used to represent a collection of triangles.
49
+
- `randomise=true`: Whether to randomise the insertion order.
50
+
- `trim=true`: Whether to remove the ghost triangles at the end.
51
+
- `trim_empty_features = true`: Whether to remove keys from the `Adjacent` map that refer to deleted edges, and edges from the `DelaunayGraph` that refer to deleted edges.
52
+
- `skip_pts`: There may be points you want to avoid adding into the triangulation, but they still exist in `pts`. If this is the case, add the indices for the points into a `Set` and set this keyword to this set.
53
+
54
+
# Outputs
55
+
The output is a `Triangulation` struct, containing
56
+
57
+
- `T`: The set of triangles.
58
+
- `adj`: The [`Adjacent`](@ref) map.
59
+
- `adj2v`: The [`Adjacent2Vertex`](@ref) map.
60
+
- `DG`: The `[DelaunayGraph`](@ref).
61
+
- `pts`: The provided point set.
62
+
63
+
The second output is `HG`, a [`HistoryGraph`](@ref).
64
+
"""
26
65
functiontriangulate_berg(pts;
27
66
IntegerType::Type{I}=Int64,
28
67
EdgeType::Type{E}=NTuple{2,IntegerType},
@@ -48,7 +87,7 @@ function triangulate_berg(pts;
48
87
trim_empty_features &&clear_empty_keys!(adj)
49
88
trim_empty_features &&clear_empty_points!(DG)
50
89
trim &&remove_bounding_triangle!(T, adj, adj2v, DG)
51
-
return T, adj, adj2v, DG, HG
90
+
returnTriangulation(T, adj, adj2v, DG, pts), HG
52
91
end
53
92
54
93
functionremove_bounding_triangle!(T::Ts, adj::Adjacent{I,E}, adj2v, DG) where {I,E,Ts}
0 commit comments