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: src/operations/add_point.jl
+13-17Lines changed: 13 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,8 @@
19
19
rng,
20
20
check_existence=Val(has_multiple_segments(tri)),
21
21
exterior_curve_index
22
-
)
22
+
),
23
+
peek = Val(false),
23
24
)
24
25
25
26
Adds the point `new_point` to the triangulation `tri`.
@@ -39,6 +40,7 @@ Adds the point `new_point` to the triangulation `tri`.
39
40
- `event_history = nothing`: The event history to store the events in. See [`InsertionEventHistory`](@ref). Only needed if `is_true(store_event_history)`. This object is not returned, instead we just mutate it inplace.
40
41
- `exterior_curve_index=1`: The curve (or curves) corresponding to the outermost boundary.
41
42
- `V=jump_and_march(tri, new_point isa Integer ? get_point(tri, new_point) : new_point; m=nothing, point_indices=nothing, try_points=nothing, k=initial_search_point, rng, check_existence=Val(has_multiple_segments(tri)), exterior_curve_index=exterior_curve_index)`: The triangle that `q` is in.
43
+
- `peek=Val(false)`: If `is_true(peek)`, then we don't actually add the point, but all operations that update the history will be run. (So you should only really want this if you are using `event_history`.)
42
44
43
45
# Outputs
44
46
The triangulation is updated in-place with the new point, but we also return the triangle `V` containing `new_point`.
@@ -63,25 +65,15 @@ function add_point!(tri::Triangulation, new_point;
63
65
rng,
64
66
check_existence=Val(has_multiple_segments(tri)),
65
67
exterior_curve_index
66
-
))
68
+
),
69
+
peek=Val(false))
67
70
if!(new_point isa Integer)
68
71
push_point!(tri, new_point)
69
72
new_point =num_points(tri)
70
73
end
71
-
#=
72
-
return add_point_bowyer_watson!(
73
-
tri,
74
-
new_point,
75
-
initial_search_point,
76
-
rng,
77
-
update_representative_point,
78
-
store_event_history,
79
-
event_history,
80
-
exterior_curve_index)
81
-
=#
82
74
q =get_point(tri, new_point)
83
75
flag =point_position_relative_to_triangle(tri, V, q)
84
-
returnadd_point_bowyer_watson_and_process_after_found_triangle!(tri, new_point, V, q, flag, update_representative_point, store_event_history, event_history)
76
+
returnadd_point_bowyer_watson_and_process_after_found_triangle!(tri, new_point, V, q, flag, update_representative_point, store_event_history, event_history, peek)
Copy file name to clipboardExpand all lines: src/predicates/general.jl
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -303,7 +303,7 @@ tests the position of `p` relative to the oriented outer halfplane defined
303
303
by `(a, b)`. The returned values are:
304
304
305
305
- `Cert.Outside`: `p` is outside of the oriented outer halfplane, meaning to the right of the line `(a, b)` or collinear with `a` and `b` but not on the line segment `(a, b)`.
306
-
- `Cert.On`: `p` is on the open line segment `(a, b)`.
306
+
- `Cert.On`: `p` is on the line segment `[a, b]`.
307
307
- `Cert.Inside`: `p` is inside of the oriented outer halfplane, meaning to the left of the line `(a, b)`.
308
308
309
309
!!! note
@@ -314,7 +314,7 @@ function point_position_relative_to_oriented_outer_halfplane(a, b, p)
add_triangle!(tri, u, new_point, g; update_ghost_edges=false)
273
+
end
272
274
ifis_true(store_event_history)
273
275
trit =triangle_type(tri)
274
276
delete_triangle!(event_history, construct_triangle(trit, u, v, g))
@@ -278,23 +280,21 @@ function add_point_bowyer_watson_dig_cavities!(
278
280
ifis_constrained(tri) && (contains_boundary_edge(tri, u, v) ||contains_boundary_edge(tri, v, u)) # If we don't do this here now, then when we try and do it later we will get a KeyError since we've already modified the boundary edge but we wouldn't have updated the constrained fields
279
281
# We also only do this if contains_boundary_edge since we want to assume that (u, v) does not appear in constrained_edges
280
282
ifcontains_boundary_edge(tri, u, v)
281
-
split_boundary_edge!(tri, u, v, new_point)
282
-
ifis_true(store_event_history)
283
-
split_boundary_edge!(event_history, u, v, new_point)
284
-
end
283
+
!is_true(peek) &&split_boundary_edge!(tri, u, v, new_point)
284
+
is_true(store_event_history) &&split_boundary_edge!(event_history, u, v, new_point)
285
285
elseifcontains_boundary_edge(tri, v, u)
286
-
split_boundary_edge!(tri, v, u, new_point)
287
-
ifis_true(store_event_history)
288
-
split_boundary_edge!(event_history, v, u, new_point)
289
-
end
286
+
!is_true(peek) &&split_boundary_edge!(tri, v, u, new_point)
287
+
is_true(store_event_history) &&split_boundary_edge!(event_history, v, u, new_point)
290
288
end
291
289
E =edge_type(tri)
292
290
# constrained_edges = get_constrained_edges(tri) < -- Don't need this actually, we're just looking at boundary edges here, so no need to consider individually constrained edges
delete_edge!(event_history, construct_edge(E, u, v))
300
300
add_edge!(event_history, construct_edge(E, u, new_point))
@@ -303,11 +303,11 @@ function add_point_bowyer_watson_dig_cavities!(
303
303
end
304
304
end
305
305
end
306
-
update_representative_point &&update_centroid_after_addition!(tri, I(1), q) # How do we efficiently determine which curve to update for a given q when adding into an existing triangulation?
306
+
update_representative_point &&!is_true(peek) &&update_centroid_after_addition!(tri, I(1), q) # How do we efficiently determine which curve to update for a given q when adding into an existing triangulation?
307
307
returnnothing
308
308
end
309
309
310
-
@inlinefunctiondig_cavity!(tri::Triangulation, r::I, i, j, ℓ, flag, V, store_event_history=Val(false), event_history=nothing) where {I}
310
+
@inlinefunctiondig_cavity!(tri::Triangulation, r::I, i, j, ℓ, flag, V, store_event_history=Val(false), event_history=nothing, peek=Val(false)) where {I}
311
311
if!edge_exists(ℓ)
312
312
# The triangle has already been deleted in this case.
313
313
returnnothing
@@ -317,9 +317,9 @@ end
317
317
!is_boundary_index(ℓ)
318
318
ℓ₁ =get_adjacent(tri, ℓ, i)
319
319
ℓ₂ =get_adjacent(tri, j, ℓ)
320
-
delete_triangle!(tri, j, i, ℓ; protect_boundary=true, update_ghost_edges=false)
321
-
dig_cavity!(tri, r, i, ℓ, ℓ₁, flag, V, store_event_history, event_history)
0 commit comments