Add a new debugging macro CGAL_MESH_2_DEBUG_REFINEMENT_POINTS

This commit is contained in:
Laurent Rineau 2021-05-12 14:45:53 +02:00
parent f46c9888e6
commit 34c2915637
4 changed files with 55 additions and 5 deletions

View File

@ -15,7 +15,7 @@
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
//
//
// Author(s) : Jane Tournois
@ -65,11 +65,19 @@ public:
{}
void set_sizing_info(const FT& s)
{
{
sizing_info_ = s;
}
const FT& sizing_info() const { return sizing_info_; }
#ifdef CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
typedef Tag_true Has_timestamp;
std::size_t time_stamp() const { return time_stamp_; }
void set_time_stamp(const std::size_t& ts) { time_stamp_ = ts; }
std::size_t time_stamp_;
#endif // CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
};
} // namespace CGAL

View File

@ -513,6 +513,14 @@ public:
va = edge.first->vertex(tr.cw (edge.second));
vb = edge.first->vertex(tr.ccw(edge.second));
#ifdef CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
std::cerr << "refinement_point_impl("
<< "#" << va->time_stamp() << ": " << va->point() << ", "
<< "#" << vb->time_stamp() << ": " << vb->point() << ") = ";
auto p = midpoint(va->point(), vb->point());
std::cerr << p << '\n';
return p;
#endif // CGAL_MESH_2_DEBUG_BAD_FACES
return midpoint(va->point(), vb->point());
}

View File

@ -80,9 +80,9 @@ class Refine_edges_base_with_clusters :
Cluster ca, cb;
clusters_iterator ca_it, cb_it;
public:
using Super::triangulation_ref_impl;
public:
/** \name CONSTRUCTORS */
Refine_edges_base_with_clusters(Tr& tr_, Clusters<Tr>& c_)
@ -100,6 +100,11 @@ public:
this->va = edge.first->vertex(Tr::cw (edge.second));
this->vb = edge.first->vertex(Tr::ccw(edge.second));
#ifdef CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
std::cerr << "refinement_point_impl("
<< "#" << this->va->time_stamp() << ": " << this->va->point() << ", "
<< "#" << this->vb->time_stamp() << ": " << this->vb->point() << ") = ";
#endif // CGAL_MESH_2_DEBUG_BAD_FACES
// std::cerr << "refinement_point_impl\n" << this->va->point() << " / "
// << this->vb->point() << std::endl;
@ -119,17 +124,32 @@ public:
std::cerr << "midpoint(" << this->va->point()
<< " , " << this->vb->point() << ")\n";
#endif // CGAL_MESH_2_DEBUG_CLUSTERS
#ifdef CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
auto p = midpoint(this->va->point(), this->vb->point());
std::cerr << p << '\n';
return p;
#endif // CGAL_MESH_2_DEBUG_BAD_FACES
return midpoint(this->va->point(), this->vb->point());
}
else {
// va only is a cluster
va_has_a_cluster = true;
#ifdef CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
auto p = split_cluster_point(this->va,this->vb,ca);
std::cerr << p << '\n';
return p;
#endif // CGAL_MESH_2_DEBUG_BAD_FACES
return split_cluster_point(this->va,this->vb,ca);
}
} else
if( clusters.get_cluster(this->vb,this->va,cb,cb_it) ){
// vb only is a cluster
vb_has_a_cluster = true;
#ifdef CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
auto p = split_cluster_point(this->vb,this->va,cb);
std::cerr << p << '\n';
return p;
#endif // CGAL_MESH_2_DEBUG_BAD_FACES
return split_cluster_point(this->vb,this->va,cb);
}else{
// no cluster
@ -137,6 +157,11 @@ public:
std::cerr << "midpoint(" << this->va->point()
<< " , " << this->vb->point() << ")\n";
#endif // CGAL_MESH_2_DEBUG_CLUSTERS
#ifdef CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
auto p = midpoint(this->va->point(), this->vb->point());
std::cerr << p << '\n';
return p;
#endif // CGAL_MESH_2_DEBUG_BAD_FACES
return midpoint(this->va->point(), this->vb->point());
}
};

View File

@ -24,7 +24,7 @@
#include <CGAL/license/Mesh_2.h>
#include <CGAL/Meshes/Triangulation_mesher_level_traits_2.h>
#include <CGAL/Mesh_2/Face_badness.h>
#include <CGAL/Double_map.h>
#include <CGAL/boost/iterator/transform_iterator.hpp>
@ -90,7 +90,7 @@ protected: // --- PROTECTED TYPES ---
typedef CGAL::Double_map<Face_handle, Quality, Face_compare> Bad_faces;
protected:
// --- PROTECTED MEMBER DATAS ---
// --- PROTECTED MEMBER DATA ---
Criteria& criteria; /**<The meshing criteria */
Previous& previous;
@ -187,6 +187,15 @@ public:
/** Returns the circumcenter of the face. */
Point refinement_point_impl(const Face_handle& f) const
{
#ifdef CGAL_MESH_2_DEBUG_REFINEMENT_POINTS
std::cerr << "refinement_point_impl("
<< "#" << f->vertex(0)->time_stamp() << ": " << f->vertex(0)->point() << ", "
<< "#" << f->vertex(1)->time_stamp() << ": " << f->vertex(1)->point() << ", "
<< "#" << f->vertex(2)->time_stamp() << ": " << f->vertex(2)->point() << ") = ";
auto p = triangulation_ref_impl().circumcenter(f);
std::cerr << p << '\n';
return p;
#endif // CGAL_MESH_2_DEBUG_BAD_FACES
return triangulation_ref_impl().circumcenter(f);
}