mirror of https://github.com/CGAL/cgal
A little less chaotic indentation (no real changes)
This commit is contained in:
parent
4321e776d0
commit
e5dfd6c8eb
|
|
@ -46,16 +46,21 @@ struct Tracer_polyhedron
|
||||||
int i, int k,
|
int i, int k,
|
||||||
bool last = true)
|
bool last = true)
|
||||||
{
|
{
|
||||||
if(i + 1 == k) { return P[i+1]; }
|
if(i + 1 == k)
|
||||||
|
return P[i+1];
|
||||||
|
|
||||||
halfedge_descriptor h, g;
|
halfedge_descriptor h, g;
|
||||||
if(i+2 == k){
|
if(i+2 == k)
|
||||||
|
{
|
||||||
if(last)
|
if(last)
|
||||||
{
|
{
|
||||||
h = P[i+1];
|
h = P[i + 1];
|
||||||
Euler::fill_hole(h,pmesh); }
|
Euler::fill_hole(h, pmesh);
|
||||||
|
}
|
||||||
else
|
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());
|
CGAL_assertion(face(h,pmesh) != boost::graph_traits<PolygonMesh>::null_face());
|
||||||
*out++ = face(h,pmesh);
|
*out++ = face(h,pmesh);
|
||||||
|
|
@ -68,12 +73,14 @@ struct Tracer_polyhedron
|
||||||
g = operator()(lambda, la, k, false);
|
g = operator()(lambda, la, k, false);
|
||||||
|
|
||||||
if(last)
|
if(last)
|
||||||
{
|
{
|
||||||
h = g;
|
h = g;
|
||||||
Euler::fill_hole(g,pmesh);
|
Euler::fill_hole(g, pmesh);
|
||||||
}
|
}
|
||||||
else
|
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());
|
CGAL_assertion(face(h,pmesh) != boost::graph_traits<PolygonMesh>::null_face());
|
||||||
*out++ = face(h,pmesh);
|
*out++ = face(h,pmesh);
|
||||||
|
|
@ -106,28 +113,29 @@ triangulate_hole_polygon_mesh(PolygonMesh& pmesh,
|
||||||
typedef std::map<vertex_descriptor, int> Vertex_map;
|
typedef std::map<vertex_descriptor, int> Vertex_map;
|
||||||
typedef typename Vertex_map::iterator Vertex_map_it;
|
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();
|
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;
|
std::vector<halfedge_descriptor> P_edges;
|
||||||
Vertex_map vertex_map;
|
Vertex_map vertex_map;
|
||||||
|
|
||||||
int id = 0;
|
int id = 0;
|
||||||
Hedge_around_face_circulator circ(border_halfedge,pmesh), done(circ);
|
Hedge_around_face_circulator circ(border_halfedge,pmesh), done(circ);
|
||||||
do{
|
do
|
||||||
|
{
|
||||||
P.push_back(get(vpmap, target(*circ, pmesh)));
|
P.push_back(get(vpmap, target(*circ, pmesh)));
|
||||||
Q.push_back(get(vpmap, target(next(opposite(next(*circ,pmesh),pmesh),pmesh),pmesh)));
|
Q.push_back(get(vpmap, target(next(opposite(next(*circ,pmesh),pmesh),pmesh),pmesh)));
|
||||||
P_edges.push_back(*circ);
|
P_edges.push_back(*circ);
|
||||||
if(!vertex_map.insert(std::make_pair(target(*circ,pmesh), id++)).second) {
|
if(!vertex_map.insert(std::make_pair(target(*circ,pmesh), id++)).second)
|
||||||
#ifndef CGAL_TEST_SUITE
|
{
|
||||||
|
#ifndef CGAL_TEST_SUITE
|
||||||
CGAL_warning_msg(false, "Returning no output. Non-manifold vertex is found on boundary!");
|
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";
|
std::cerr << "W: Returning no output. Non-manifold vertex is found on boundary!\n";
|
||||||
#endif
|
#endif
|
||||||
return std::make_pair(out,
|
return std::make_pair(out, CGAL::internal::Weight_min_max_dihedral_and_area::NOT_VALID());
|
||||||
CGAL::internal::Weight_min_max_dihedral_and_area::NOT_VALID());
|
|
||||||
}
|
}
|
||||||
} while (++circ != done);
|
} 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
|
if(v_it_neigh_it != vertex_map.end()) //other endpoint found in the map
|
||||||
{
|
{
|
||||||
int v_it_neigh_id = v_it_neigh_it->second;
|
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 )
|
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
|
{
|
||||||
|
//there is an edge incident to v_it, which is not next or previous
|
||||||
//from vertex_map (checked by comparing IDs)
|
//from vertex_map (checked by comparing IDs)
|
||||||
if(v_it_id < v_it_neigh_id) // to include each edge only once
|
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);
|
} while(++circ_vertex != done_vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define CGAL_USE_WEIGHT_INCOMPLETE
|
//#define CGAL_USE_WEIGHT_INCOMPLETE
|
||||||
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
|
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
|
||||||
typedef CGAL::internal::Weight_calculator<Weight_incomplete<CGAL::internal::Weight_min_max_dihedral_and_area>,
|
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;
|
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,
|
typedef CGAL::internal::Weight_calculator<CGAL::internal::Weight_min_max_dihedral_and_area,
|
||||||
CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle> WC;
|
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);
|
CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle is_valid(existing_edges);
|
||||||
|
|
||||||
// fill hole using polyline function, with custom tracer for PolygonMesh
|
// fill hole using polyline function, with custom tracer for PolygonMesh
|
||||||
Tracer_polyhedron<PolygonMesh, OutputIterator>
|
Tracer_polyhedron<PolygonMesh, OutputIterator> tracer(out, pmesh, P_edges);
|
||||||
tracer(out, pmesh, P_edges);
|
|
||||||
|
|
||||||
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_CDT2
|
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_CDT2
|
||||||
if(use_cdt && triangulate_hole_polyline_with_cdt(P, tracer, is_valid, k, max_squared_distance))
|
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));
|
||||||
return std::make_pair(tracer.out, CGAL::internal::Weight_min_max_dihedral_and_area(0,0));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
CGAL::internal::Weight_min_max_dihedral_and_area weight =
|
CGAL::internal::Weight_min_max_dihedral_and_area weight =
|
||||||
triangulate_hole_polyline(P, Q, tracer, WC(is_valid),
|
#ifndef CGAL_USE_WEIGHT_INCOMPLETE
|
||||||
use_delaunay_triangulation, k)
|
triangulate_hole_polyline(P, Q, tracer, WC(is_valid), use_delaunay_triangulation, k);
|
||||||
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
|
#else
|
||||||
.weight // get actual weight in Weight_incomplete
|
// get actual weight in Weight_incomplete
|
||||||
|
triangulate_hole_polyline(P, Q, tracer, WC(is_valid), use_delaunay_triangulation, k).weight;
|
||||||
#endif
|
#endif
|
||||||
;
|
|
||||||
|
|
||||||
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
|
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
|
||||||
std::cerr << "Hole filling: " << timer.time() << " sc." << std::endl; timer.reset();
|
std::cerr << "Hole filling: " << timer.time() << " sc." << std::endl; timer.reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return std::make_pair(tracer.out, weight);
|
return std::make_pair(tracer.out, weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
}// namespace internal
|
} // namespace internal
|
||||||
}// namespace Polygon_mesh_processing
|
} // namespace Polygon_mesh_processing
|
||||||
}// namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif //CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYHEDRON_3_H
|
#endif //CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYHEDRON_3_H
|
||||||
|
|
|
||||||
|
|
@ -1492,11 +1492,11 @@ triangulate_hole_polyline(const PointRange1& points,
|
||||||
|
|
||||||
typedef Kernel K;
|
typedef Kernel K;
|
||||||
typedef typename K::Point_3 Point_3;
|
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;
|
typedef CGAL::internal::Triangulate_hole_polyline_DT<K, Tracer, WeightCalculator> Fill_DT;
|
||||||
#else
|
#else
|
||||||
CGAL_USE(use_delaunay_triangulation);
|
CGAL_USE(use_delaunay_triangulation);
|
||||||
#endif
|
#endif
|
||||||
typedef CGAL::internal::Triangulate_hole_polyline<K, Tracer, WeightCalculator> Fill;
|
typedef CGAL::internal::Triangulate_hole_polyline<K, Tracer, WeightCalculator> Fill;
|
||||||
|
|
||||||
std::vector<Point_3> P(boost::begin(points), boost::end(points));
|
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 =
|
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) :
|
use_delaunay_triangulation ? Fill_DT().operator()(P,Q,tracer,WC) :
|
||||||
#endif
|
#endif
|
||||||
Fill().operator()(P,Q,tracer,WC);
|
Fill().operator()(P,Q,tracer,WC);
|
||||||
|
|
||||||
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
|
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_DT3
|
||||||
if (use_delaunay_triangulation
|
if(use_delaunay_triangulation && w == WeightCalculator::Weight::NOT_VALID())
|
||||||
&& w == WeightCalculator::Weight::NOT_VALID())
|
|
||||||
w = Fill().operator()(P, Q, tracer, WC);
|
w = Fill().operator()(P, Q, tracer, WC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
|
#ifdef CGAL_PMP_HOLE_FILLING_DEBUG
|
||||||
std::cerr << w << std::endl;
|
std::cerr << w << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue