Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try and fix triangulation of a degenerate set #217

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DelaunayTriangulation"
uuid = "927a84f5-c5f4-47a5-9785-b46e178433df"
authors = ["Daniel VandenHeuvel <[email protected]>"]
version = "1.6.3"
version = "1.6.4"

[deps]
AdaptivePredicates = "35492f91-a3bd-45ad-95db-fcad7dcfedb7"
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/point_location/jump_and_march.jl
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
k = get_adjacent(tri, i, j)
return (true, Cert.On, i, j, k) # true is the return_flag
end
return (false, Cert.Outside, i, j, k)
return (false, Cert.Outside, i, j, get_adjacent(tri, i, j))

Check warning on line 422 in src/algorithms/point_location/jump_and_march.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/point_location/jump_and_march.jl#L422

Added line #L422 was not covered by tests
end
function search_left_down_adjacent_boundary_edges(tri::Triangulation, q, q_pos, predicates::AbstractPredicateKernel, store_history::F, history, ghost_vertex, i, j, pⱼ) where {F}
if is_true(store_history) # in case we don't enter the loop
Expand All @@ -445,7 +445,7 @@
k = get_adjacent(tri, j, i)
return (true, Cert.On, j, i, k)
end
return (false, Cert.Outside, i, j, k)
return (false, Cert.Outside, i, j, get_adjacent(tri, i, j))

Check warning on line 448 in src/algorithms/point_location/jump_and_march.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/point_location/jump_and_march.jl#L448

Added line #L448 was not covered by tests
end

"""
Expand Down
4 changes: 2 additions & 2 deletions src/algorithms/triangulation/unconstrained_triangulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@
) where {M}
initialise_bowyer_watson!(tri, insertion_order, predicates)
remaining_points = @view insertion_order[(begin + 3):end]
for (num_points, new_point) in enumerate(remaining_points)
initial_search_point = get_initial_search_point(tri, num_points, new_point, insertion_order, num_sample_rule, rng, try_last_inserted_point)
for (npts, new_point) in enumerate(remaining_points)
initial_search_point = get_initial_search_point(tri, npts, new_point, insertion_order, num_sample_rule, rng, try_last_inserted_point)

Check warning on line 461 in src/algorithms/triangulation/unconstrained_triangulation.jl

View check run for this annotation

Codecov / codecov/patch

src/algorithms/triangulation/unconstrained_triangulation.jl#L460-L461

Added lines #L460 - L461 were not covered by tests
add_point_bowyer_watson!(tri, new_point, initial_search_point, rng, predicates)
end
convex_hull!(tri; predicates, reconstruct = false)
Expand Down
8 changes: 7 additions & 1 deletion test/point_location/jump_and_march.jl
Original file line number Diff line number Diff line change
Expand Up @@ -764,4 +764,10 @@ end
@test DT.is_positively_oriented(DT.triangle_orientation(tri, V))
@test DT.is_inside(DT.point_position_relative_to_triangle(tri, V, (1e-16, 0.0)))
end
end
end

"Issue #216"
points = [(1.0791812460476249, -3.7886681935906106), (1.0791812460476249, -4.4006006582615305), (1.0791812460476249, -5.012533122932451), (1.0791812460476249, -4.022405596275408), (1.0791812460476249, -4.634338060946328), (1.0791812460476249, -5.2462705256172475), (1.0791812460476249, -4.256142998960205), (1.0791812460476249, -4.868075463631126), (1.0791812460476249, -3.877947936974082), (1.0791812460476249, -4.489880401645002), (1.0791812460476249, -5.101812866315922), (1.0791812460476249, -4.111685339658881), (1.0791812460476249, -4.723617804329802), (1.0791812460476249, -3.7334902776727588), (1.0791812460476249, -4.345422742343679), (1.0791812460476249, -4.957355207014598), (1.0791812460476249, -3.967227680357556), (1.0791812460476249, -4.579160145028475), (1.0791812460476249, -5.191092609699395), (1.0791812460476249, -4.200965083042353), (1.0791812460476249, -4.8128975477132725)]
tri = triangulate(points; randomise=false) # PointNotFoundError
tri = Triangulation(points)
DelaunayTriangulation.initialise_bowyer_watson!(tri, insertion_order, predicates)
Loading