This commit is contained in:
Jane Tournois 2023-10-26 12:25:49 +02:00
parent fb7a3d9cde
commit be21cfc4d6
3 changed files with 13 additions and 22 deletions

View File

@ -274,7 +274,7 @@ void split_long_edges(C3T3& c3t3,
if (!can_be_split(e, c3t3, protect_boundaries, cell_selector))
continue;
const std::optional<FT> sqlen = is_too_long<T3>(e, sizing, tr);
const std::optional<FT> sqlen = is_too_long(e, sizing, tr);
if(sqlen != std::nullopt)
long_edges.insert(long_edge(make_vertex_pair<T3>(e), sqlen.value()));
}

View File

@ -174,29 +174,14 @@ public:
return m_c3t3_pbackup != NULL;
}
bool is_too_short(const Edge& e) const
{
const FT target_edge_length
= m_sizing(CGAL::midpoint(tr().segment(e)),
0,
0);
const FT emin = FT(4)/FT(5) * target_edge_length;
return tr().segment(e).squared_length() < CGAL::square(emin * emin);
}
bool is_too_long_or_too_short(const Edge& e) const
{
const FT sqlen = tr().segment(e).squared_length();
const FT target_edge_length
= m_sizing(CGAL::midpoint(tr().segment(e)),
0,
0);
const FT sq_emax = CGAL::square(FT(4)/FT(3) * target_edge_length);
const FT sqlen = squared_edge_length(e, tr());
const FT sq_emax = squared_upper_size_bound(e, m_sizing, tr());
if(sqlen > sq_emax)
return true;
const FT sq_emin = CGAL::square(FT(4)/FT(5) * target_edge_length);
const FT sq_emin = squared_lower_size_bound(e, m_sizing, tr());
if (sqlen < sq_emin)
return true;

View File

@ -988,6 +988,13 @@ squared_lower_size_bound(const typename Tr::Edge& e,
return CGAL::square(emin);
}
template<typename Tr>
typename Tr::Geom_traits::FT
squared_edge_length(const typename Tr::Edge& e, const Tr& tr)
{
return tr.geom_traits().compute_squared_length_3_object()(tr.segment(e));
}
template<typename Tr, typename Sizing>
std::optional<typename Tr::Geom_traits::FT>
is_too_long(const typename Tr::Edge& e,
@ -995,10 +1002,9 @@ is_too_long(const typename Tr::Edge& e,
const Tr& tr)
{
using FT = typename Tr::Geom_traits::FT;
auto sql = tr.geom_traits().compute_squared_length_3_object();
const FT sq_max = squared_upper_size_bound(e, sizing, tr);
const FT sqlen = sql(tr.segment(e));
const FT sqlen = squared_edge_length(e, tr);
if (sqlen > sq_max)
return sqlen;
@ -1016,7 +1022,7 @@ is_too_short(const typename Tr::Edge& e,
auto sql = tr.geom_traits().compute_squared_length_3_object();
const FT sq_min = squared_lower_size_bound(e, sizing, tr);
const FT sqlen = sql(tr.segment(e));
const FT sqlen = squared_edge_length(e, tr);
if (sqlen < sq_min)
return sqlen;