fix shortest_non_loop_edge

This commit is contained in:
Camille Lanuel 2025-11-29 09:50:49 +01:00
parent bf2e6c72f7
commit 4b626a3fe7
4 changed files with 7 additions and 4 deletions

View File

@ -202,7 +202,7 @@ public:
*/
double shortest_loop() const;
/*!
\return a `double` approximation of the length of the shortest non-loop edge in the Delaunay triangulation.
\return a `double` approximation of the length of the shortest non-loop edge in the Delaunay triangulation. Returns 0 (NULL) if all edges are loops.
*/
double shortest_non_loop_edge() const;
/// @}

View File

@ -1094,6 +1094,7 @@ Delaunay_triangulation_on_hyperbolic_surface_2<Traits>::
shortest_non_loop_edge() const
{
Number min_delta_length = 999;
double res = NULL;
for (typename Edge_const_range::const_iterator it = this->combinatorial_map_.template one_dart_per_cell<1>().begin();
it != this->combinatorial_map_.template one_dart_per_cell<1>().end(); ++it) {
Anchor const & current_anchor = anchor(it);
@ -1112,10 +1113,11 @@ shortest_non_loop_edge() const
}
if(!is_loop) {
Number delta_length = delta(a, b);
min_delta_length = min(min_delta_length,delta_length);
min_delta_length = min(min_delta_length, delta_length);
res = std::acosh(1 + to_double(min_delta_length));
}
}
return std::acosh(1 + to_double(min_delta_length));
return res;
}
} // namespace CGAL

View File

@ -80,7 +80,7 @@ int main()
assert(same_vertices);
assert(dt.shortest_loop() != 0);
assert(dt.shortest_non_loop_edge() != 0);
assert(dt.shortest_non_loop_edge() == 0);
return 0;
}

View File

@ -60,6 +60,7 @@ int main(int argc, char *argv[])
assert(is_eps_net);
assert(dt.is_valid());
assert(dt.shortest_non_loop_edge() != 0);
return 0;
}