Skip to content

Commit 7f264bf

Browse files
committed
move the modifications to Tadjadj2vDG into a new function
1 parent 23f98dd commit 7f264bf

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DelaunayTriangulation"
22
uuid = "927a84f5-c5f4-47a5-9785-b46e178433df"
33
authors = ["Daniel VandenHeuvel <[email protected]>"]
4-
version = "0.3.0"
4+
version = "0.3.1"
55

66
[deps]
77
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"

src/bowyerwatson.jl

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function add_point_bowyer!(T::Ts, adj::Adjacent{I,E}, adj2v, DG, pts, r;
22
pt_idx=graph(DG).V, m=ceil(Int64, length(pt_idx)^(1 / 3)),
3-
initial_search_point=select_initial_point(pts, r; pt_idx, m)) where {Ts,I,E}
3+
initial_search_point=select_initial_point(pts, r; pt_idx, m)) where {Ts,I,E}
44
r = I(r)
55
tri_type = triangle_type(Ts)
66
V = jump_and_march(r, adj, adj2v, DG, pts; k=initial_search_point, TriangleType=tri_type)
@@ -94,15 +94,27 @@ function triangulate_bowyer(pts;
9494
randomise=true,
9595
trim=true,
9696
try_last_inserted_point=true,
97-
trim_empty_features = true,
97+
trim_empty_features=true,
9898
skip_pts=Set{Int64}()) where {I,E,V,Es,Ts}
99-
!all_points_are_unique(pts) && throw("The points must all be unique.")
100-
pt_order = randomise ? shuffle(_eachindex(pts)) : collect(_eachindex(pts))
101-
setdiff!(pt_order, skip_pts)
10299
T = construct_triangles(Ts)
103100
adj = Adjacent{I,E}()
104101
adj2v = Adjacent2Vertex{I,Es,E}()
105102
DG = DelaunayGraph{I}()
103+
_triangulate_bowyer!(T, adj, adj2v, DG, pts; IntegerType, TriangleType, randomise, trim, try_last_inserted_point, trim_empty_features, skip_pts)
104+
return Triangulation(T, adj, adj2v, DG, pts)
105+
end
106+
107+
function _triangulate_bowyer!(T, adj, adj2v, DG, pts;
108+
IntegerType::Type{I}=Int64,
109+
TriangleType::Type{V}=NTuple{3,IntegerType},
110+
randomise=true,
111+
trim=true,
112+
try_last_inserted_point=true,
113+
trim_empty_features=true,
114+
skip_pts=Set{Int64}()) where {I,V}
115+
!all_points_are_unique(pts) && throw("The points must all be unique.")
116+
pt_order = randomise ? shuffle(_eachindex(pts)) : collect(_eachindex(pts))
117+
setdiff!(pt_order, skip_pts)
106118
initial_triangle = construct_positively_oriented_triangle(TriangleType, I(pt_order[begin]), I(pt_order[begin+1]), I(pt_order[begin+2]), pts)
107119
while isoriented(initial_triangle, pts) == 0 # We cannot start with a degenerate triangle. We need to shift the insertion order
108120
circshift!(pt_order, 1)
@@ -129,7 +141,7 @@ function triangulate_bowyer(pts;
129141
trim_empty_features && clear_empty_keys!(adj)
130142
trim_empty_features && clear_empty_points!(DG)
131143
trim && remove_ghost_triangles!(T, adj, adj2v, DG)
132-
return Triangulation(T, adj, adj2v, DG, pts)
144+
return nothing
133145
end
134146

135147
function lazy_triangulate_bowyer(pts;

0 commit comments

Comments
 (0)