1
1
function add_point_bowyer! (T:: Ts , adj:: Adjacent{I,E} , adj2v, DG, pts, r;
2
2
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}
4
4
r = I (r)
5
5
tri_type = triangle_type (Ts)
6
6
V = jump_and_march (r, adj, adj2v, DG, pts; k= initial_search_point, TriangleType= tri_type)
@@ -94,15 +94,27 @@ function triangulate_bowyer(pts;
94
94
randomise= true ,
95
95
trim= true ,
96
96
try_last_inserted_point= true ,
97
- trim_empty_features = true ,
97
+ trim_empty_features= true ,
98
98
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)
102
99
T = construct_triangles (Ts)
103
100
adj = Adjacent {I,E} ()
104
101
adj2v = Adjacent2Vertex {I,Es,E} ()
105
102
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)
106
118
initial_triangle = construct_positively_oriented_triangle (TriangleType, I (pt_order[begin ]), I (pt_order[begin + 1 ]), I (pt_order[begin + 2 ]), pts)
107
119
while isoriented (initial_triangle, pts) == 0 # We cannot start with a degenerate triangle. We need to shift the insertion order
108
120
circshift! (pt_order, 1 )
@@ -129,7 +141,7 @@ function triangulate_bowyer(pts;
129
141
trim_empty_features && clear_empty_keys! (adj)
130
142
trim_empty_features && clear_empty_points! (DG)
131
143
trim && remove_ghost_triangles! (T, adj, adj2v, DG)
132
- return Triangulation (T, adj, adj2v, DG, pts)
144
+ return nothing
133
145
end
134
146
135
147
function lazy_triangulate_bowyer (pts;
0 commit comments