A little less chaotic indentation (no real changes)

This commit is contained in:
Mael Rouxel-Labbé 2021-12-03 15:49:34 +01:00
parent 4321e776d0
commit e5dfd6c8eb
2 changed files with 60 additions and 53 deletions

View File

@ -46,16 +46,21 @@ struct Tracer_polyhedron
int i, int k,
bool last = true)
{
if(i + 1 == k) { return P[i+1]; }
if(i + 1 == k)
return P[i+1];
halfedge_descriptor h, g;
if(i+2 == k){
if(i+2 == k)
{
if(last)
{
h = P[i+1];
Euler::fill_hole(h,pmesh); }
{
h = P[i + 1];
Euler::fill_hole(h, pmesh);
}
else
{ h = Euler::add_face_to_border(prev(P[i+1],pmesh), P[i+2/*k*/], pmesh); }
{
h = Euler::add_face_to_border(prev(P[i + 1], pmesh), P[i + 2 /*k*/], pmesh);
}
CGAL_assertion(face(h,pmesh) != boost::graph_traits<PolygonMesh>::null_face());
*out++ = face(h,pmesh);
@ -68,12 +73,14 @@ struct Tracer_polyhedron
g = operator()(lambda, la, k, false);
if(last)
{
h = g;
Euler::fill_hole(g,pmesh);
}
{
h = g;
Euler::fill_hole(g, pmesh);
}
else
{ h = Euler::add_face_to_border(prev(h,pmesh), g, pmesh); }
{
h = Euler::add_face_to_border(prev(h, pmesh), g, pmesh);
}
CGAL_assertion(face(h,pmesh) != boost::graph_traits<PolygonMesh>::null_face());
*out++ = face(h,pmesh);
@ -106,28 +113,29 @@ triangulate_hole_polygon_mesh(PolygonMesh& pmesh,
typedef std::map<vertex_descriptor, int> Vertex_map;
typedef typename Vertex_map::iterator Vertex_map_it;
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
CGAL::Timer timer; timer.start();
#endif
#endif
std::vector<Point_3> P, Q;
std::vector<Point_3> P, Q;
std::vector<halfedge_descriptor> P_edges;
Vertex_map vertex_map;
int id = 0;
Hedge_around_face_circulator circ(border_halfedge,pmesh), done(circ);
do{
do
{
P.push_back(get(vpmap, target(*circ, pmesh)));
Q.push_back(get(vpmap, target(next(opposite(next(*circ,pmesh),pmesh),pmesh),pmesh)));
P_edges.push_back(*circ);
if(!vertex_map.insert(std::make_pair(target(*circ,pmesh), id++)).second) {
#ifndef CGAL_TEST_SUITE
if(!vertex_map.insert(std::make_pair(target(*circ,pmesh), id++)).second)
{
#ifndef CGAL_TEST_SUITE
CGAL_warning_msg(false, "Returning no output. Non-manifold vertex is found on boundary!");
#else
#else
std::cerr << "W: Returning no output. Non-manifold vertex is found on boundary!\n";
#endif
return std::make_pair(out,
CGAL::internal::Weight_min_max_dihedral_and_area::NOT_VALID());
#endif
return std::make_pair(out, CGAL::internal::Weight_min_max_dihedral_and_area::NOT_VALID());
}
} while (++circ != done);
@ -151,52 +159,52 @@ triangulate_hole_polygon_mesh(PolygonMesh& pmesh,
if(v_it_neigh_it != vertex_map.end()) //other endpoint found in the map
{
int v_it_neigh_id = v_it_neigh_it->second;
if( v_it_neigh_id != v_it_prev && v_it_neigh_id != v_it_next )
{ //there is an edge incident to v_it, which is not next or previous
if(v_it_neigh_id != v_it_prev && v_it_neigh_id != v_it_next)
{
//there is an edge incident to v_it, which is not next or previous
//from vertex_map (checked by comparing IDs)
if(v_it_id < v_it_neigh_id) // to include each edge only once
{ existing_edges.push_back(std::make_pair(v_it_id, v_it_neigh_id)); }
existing_edges.push_back(std::make_pair(v_it_id, v_it_neigh_id));
}
}
} while(++circ_vertex != done_vertex);
}
//#define CGAL_USE_WEIGHT_INCOMPLETE
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
//#define CGAL_USE_WEIGHT_INCOMPLETE
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
typedef CGAL::internal::Weight_calculator<Weight_incomplete<CGAL::internal::Weight_min_max_dihedral_and_area>,
CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle> WC;
#else
#else
typedef CGAL::internal::Weight_calculator<CGAL::internal::Weight_min_max_dihedral_and_area,
CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle> WC;
#endif
#endif
CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle is_valid(existing_edges);
// fill hole using polyline function, with custom tracer for PolygonMesh
Tracer_polyhedron<PolygonMesh, OutputIterator>
tracer(out, pmesh, P_edges);
Tracer_polyhedron<PolygonMesh, OutputIterator> tracer(out, pmesh, P_edges);
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_CDT2
if(use_cdt && triangulate_hole_polyline_with_cdt(P, tracer, is_valid, k, max_squared_distance))
{
return std::make_pair(tracer.out, CGAL::internal::Weight_min_max_dihedral_and_area(0,0));
}
if(use_cdt && triangulate_hole_polyline_with_cdt(P, tracer, is_valid, k, max_squared_distance))
return std::make_pair(tracer.out, CGAL::internal::Weight_min_max_dihedral_and_area(0,0));
#endif
CGAL::internal::Weight_min_max_dihedral_and_area weight =
triangulate_hole_polyline(P, Q, tracer, WC(is_valid),
use_delaunay_triangulation, k)
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
.weight // get actual weight in Weight_incomplete
#ifndef CGAL_USE_WEIGHT_INCOMPLETE
triangulate_hole_polyline(P, Q, tracer, WC(is_valid), use_delaunay_triangulation, k);
#else
// get actual weight in Weight_incomplete
triangulate_hole_polyline(P, Q, tracer, WC(is_valid), use_delaunay_triangulation, k).weight;
#endif
;
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
std::cerr << "Hole filling: " << timer.time() << " sc." << std::endl; timer.reset();
#endif
#endif
return std::make_pair(tracer.out, weight);
}
}// namespace internal
}// namespace Polygon_mesh_processing
}// namespace CGAL
} // namespace internal
} // namespace Polygon_mesh_processing
} // namespace CGAL
#endif //CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYHEDRON_3_H

View File

@ -1492,11 +1492,11 @@ triangulate_hole_polyline(const PointRange1& points,
typedef Kernel K;
typedef typename K::Point_3 Point_3;
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
typedef CGAL::internal::Triangulate_hole_polyline_DT<K, Tracer, WeightCalculator> Fill_DT;
#else
#else
CGAL_USE(use_delaunay_triangulation);
#endif
#endif
typedef CGAL::internal::Triangulate_hole_polyline<K, Tracer, WeightCalculator> Fill;
std::vector<Point_3> P(boost::begin(points), boost::end(points));
@ -1510,20 +1510,19 @@ triangulate_hole_polyline(const PointRange1& points,
}
typename WeightCalculator::Weight w =
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
use_delaunay_triangulation ? Fill_DT().operator()(P,Q,tracer,WC) :
#endif
#endif
Fill().operator()(P,Q,tracer,WC);
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
if (use_delaunay_triangulation
&& w == WeightCalculator::Weight::NOT_VALID())
if(use_delaunay_triangulation && w == WeightCalculator::Weight::NOT_VALID())
w = Fill().operator()(P, Q, tracer, WC);
#endif
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
std::cerr << w << std::endl;
#endif
#endif
return w;
}