mirror of https://github.com/CGAL/cgal
avoid computing twice the biggest incident facet
This commit is contained in:
parent
05b80838e7
commit
d46efd537f
|
|
@ -245,22 +245,17 @@ private:
|
||||||
return { biggest_facet, biggest_sq_dist };
|
return { biggest_facet, biggest_sq_dist };
|
||||||
}
|
}
|
||||||
|
|
||||||
bool biggest_incident_facet_is_smaller_than_min_size(const Edge& e) const
|
bool is_smaller_than_min_size(const FT& sq_dist) const
|
||||||
{
|
{
|
||||||
if(!m_facet_min_size)
|
if(!m_facet_min_size)
|
||||||
return false;
|
return false;
|
||||||
|
return sq_dist < CGAL::square(*m_facet_min_size);
|
||||||
const FT sq_dist = biggest_incident_facet_in_complex(e).second;
|
|
||||||
return (sq_dist < CGAL::square(*m_facet_min_size));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool biggest_incident_facet_is_smaller_than_min_size(const Vertex_handle& v) const
|
template<typename T> //T may be Edge or Vertex_handle
|
||||||
|
bool biggest_incident_facet_is_smaller_than_min_size(const T& t) const
|
||||||
{
|
{
|
||||||
if(!m_facet_min_size)
|
return is_smaller_than_min_size(biggest_incident_facet_in_complex(t).second);
|
||||||
return false;
|
|
||||||
|
|
||||||
const FT sq_dist = biggest_incident_facet_in_complex(v).second;
|
|
||||||
return (sq_dist < CGAL::square(*m_facet_min_size));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
|
@ -379,15 +374,15 @@ public:
|
||||||
( (!m_with_boundary) &&
|
( (!m_with_boundary) &&
|
||||||
(this->r_c3t3_.face_status(*eit) == C3t3::BOUNDARY) ) )
|
(this->r_c3t3_.face_status(*eit) == C3t3::BOUNDARY) ) )
|
||||||
{
|
{
|
||||||
if (biggest_incident_facet_is_smaller_than_min_size(*eit))
|
const auto [biggest_f, sq_dist] = biggest_incident_facet_in_complex(*eit);
|
||||||
|
if (is_smaller_than_min_size(sq_dist))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef CGAL_LINKED_WITH_TBB
|
#ifdef CGAL_LINKED_WITH_TBB
|
||||||
// Parallel
|
// Parallel
|
||||||
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
||||||
{
|
{
|
||||||
this->insert_bad_facet(biggest_incident_facet_in_complex(*eit).first,
|
this->insert_bad_facet(biggest_f, typename Base::Quality());
|
||||||
typename Base::Quality());
|
|
||||||
} else
|
} else
|
||||||
#endif // CGAL_LINKED_WITH_TBB
|
#endif // CGAL_LINKED_WITH_TBB
|
||||||
{ // Sequential
|
{ // Sequential
|
||||||
|
|
@ -422,7 +417,8 @@ public:
|
||||||
{
|
{
|
||||||
if( this->r_c3t3_.face_status(vit) == C3t3::SINGULAR )
|
if( this->r_c3t3_.face_status(vit) == C3t3::SINGULAR )
|
||||||
{
|
{
|
||||||
if(biggest_incident_facet_is_smaller_than_min_size(vit))
|
const auto [biggest_f, sq_dist] = biggest_incident_facet_in_complex(vit);
|
||||||
|
if (is_smaller_than_min_size(sq_dist))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
|
#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
|
||||||
|
|
@ -433,8 +429,7 @@ public:
|
||||||
// Parallel
|
// Parallel
|
||||||
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
||||||
{
|
{
|
||||||
this->insert_bad_facet(biggest_incident_facet_in_complex(vit).first,
|
this->insert_bad_facet(biggest_f, typename Base::Quality());
|
||||||
typename Base::Quality());
|
|
||||||
} else
|
} else
|
||||||
#endif // CGAL_LINKED_WITH_TBB
|
#endif // CGAL_LINKED_WITH_TBB
|
||||||
{ // Sequential
|
{ // Sequential
|
||||||
|
|
@ -597,15 +592,17 @@ public:
|
||||||
(this->r_c3t3_.face_status(edge) == C3t3::BOUNDARY) )
|
(this->r_c3t3_.face_status(edge) == C3t3::BOUNDARY) )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (biggest_incident_facet_is_smaller_than_min_size(edge))
|
const auto [biggest_f, sq_dist] = biggest_incident_facet_in_complex(edge);
|
||||||
|
if (is_smaller_than_min_size(sq_dist))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef CGAL_LINKED_WITH_TBB
|
#ifdef CGAL_LINKED_WITH_TBB
|
||||||
// Parallel
|
// Parallel
|
||||||
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
||||||
{
|
{
|
||||||
this->insert_bad_facet(biggest_incident_facet_in_complex(edge).first,
|
this->insert_bad_facet(biggest_f, typename Base::Quality());
|
||||||
typename Base::Quality());
|
}
|
||||||
} else
|
else
|
||||||
#endif // CGAL_LINKED_WITH_TBB
|
#endif // CGAL_LINKED_WITH_TBB
|
||||||
{ // Sequential
|
{ // Sequential
|
||||||
m_bad_edges.insert(Bad_edge(edge_to_edgevv(edge),
|
m_bad_edges.insert(Bad_edge(edge_to_edgevv(edge),
|
||||||
|
|
@ -647,7 +644,8 @@ public:
|
||||||
// !this->r_c3t3_.is_regular_or_boundary_for_vertices(*vit)
|
// !this->r_c3t3_.is_regular_or_boundary_for_vertices(*vit)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if(biggest_incident_facet_is_smaller_than_min_size(*vit))
|
const auto [biggest_f, sq_dist] = biggest_incident_facet_in_complex(*vit);
|
||||||
|
if (is_smaller_than_min_size(sq_dist))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
|
#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
|
||||||
|
|
@ -658,9 +656,9 @@ public:
|
||||||
// Parallel
|
// Parallel
|
||||||
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
||||||
{
|
{
|
||||||
this->insert_bad_facet(biggest_incident_facet_in_complex(*vit).first,
|
this->insert_bad_facet(biggest_f, typename Base::Quality());
|
||||||
typename Base::Quality());
|
}
|
||||||
} else
|
else
|
||||||
#endif // CGAL_LINKED_WITH_TBB
|
#endif // CGAL_LINKED_WITH_TBB
|
||||||
{ // Sequential
|
{ // Sequential
|
||||||
m_bad_vertices.insert(*vit);
|
m_bad_vertices.insert(*vit);
|
||||||
|
|
@ -669,11 +667,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this->r_c3t3_.has_incident_facets_in_complex(v) &&
|
if ( this->r_c3t3_.has_incident_facets_in_complex(v) &&
|
||||||
(this->r_c3t3_.face_status(v) == C3t3::SINGULAR) &&
|
(this->r_c3t3_.face_status(v) == C3t3::SINGULAR)
|
||||||
!biggest_incident_facet_is_smaller_than_min_size(v)
|
|
||||||
// !this->r_c3t3_.is_regular_or_boundary_for_vertices(v)
|
// !this->r_c3t3_.is_regular_or_boundary_for_vertices(v)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
const auto [biggest_f, sq_dist] = biggest_incident_facet_in_complex(v);
|
||||||
|
if (is_smaller_than_min_size(sq_dist))
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
|
#ifdef CGAL_MESHES_DEBUG_REFINEMENT_POINTS
|
||||||
std::cerr << "m_bad_vertices.insert("
|
std::cerr << "m_bad_vertices.insert("
|
||||||
<< this->r_tr_.point(v) << ")\n";
|
<< this->r_tr_.point(v) << ")\n";
|
||||||
|
|
@ -682,9 +683,9 @@ public:
|
||||||
// Parallel
|
// Parallel
|
||||||
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
if (std::is_convertible<Concurrency_tag, Parallel_tag>::value)
|
||||||
{
|
{
|
||||||
this->insert_bad_facet(biggest_incident_facet_in_complex(v).first,
|
this->insert_bad_facet(biggest_f, typename Base::Quality());
|
||||||
typename Base::Quality());
|
}
|
||||||
} else
|
else
|
||||||
#endif // CGAL_LINKED_WITH_TBB
|
#endif // CGAL_LINKED_WITH_TBB
|
||||||
{ // Sequential
|
{ // Sequential
|
||||||
m_bad_vertices.insert(v);
|
m_bad_vertices.insert(v);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue