Skip to content

Commit 0109c9f

Browse files
committed
restore is_valid parameter that is responsible to prevent bends
1 parent 97c43a8 commit 0109c9f

File tree

6 files changed

+17
-38
lines changed

6 files changed

+17
-38
lines changed

PMP_Mesh_repair/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ triangulate_hole_polygon_mesh(PolygonMesh& pmesh,
195195
Tracer_polyhedron<PolygonMesh, OutputIterator> tracer(out, pmesh, P_edges);
196196

197197
#ifndef CGAL_HOLE_FILLING_DO_NOT_USE_CDT2
198-
if(use_cdt && triangulate_hole_polyline_with_cdt(P, tracer, visitor, k, max_squared_distance))
198+
if(use_cdt && ::CGAL::internal::triangulate_hole_polyline_with_cdt(P, tracer, visitor, is_valid, k, max_squared_distance))
199199
return std::make_pair(tracer.out, CGAL::internal::Weight_min_max_dihedral_and_area(0,0));
200200
#endif
201201
CGAL::internal::Weight_min_max_dihedral_and_area weight =

PMP_Mesh_repair/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1352,12 +1352,14 @@ template <
13521352
typename PointRange, // need size()
13531353
typename Tracer,
13541354
typename Visitor,
1355+
typename Validity_checker,
13551356
typename Traits
13561357
>
13571358
bool
13581359
triangulate_hole_polyline_with_cdt(const PointRange& points,
13591360
Tracer& tracer,
13601361
Visitor& visitor,
1362+
const Validity_checker& is_valid,
13611363
const Traits& traits,
13621364
const typename Traits::FT max_squared_distance)
13631365
{
@@ -1467,6 +1469,12 @@ triangulate_hole_polyline_with_cdt(const PointRange& points,
14671469
vertices[v->info()] = v;
14681470
}
14691471

1472+
if (vertices.size()!=cdt.number_of_vertices())
1473+
{
1474+
visitor.end_planar_phase(false);
1475+
return false;
1476+
}
1477+
14701478
try
14711479
{
14721480
for (std::size_t i = 0; i < size; ++i) {
@@ -1524,7 +1532,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points,
15241532

15251533
std::sort(is.begin(), is.end());
15261534
lambda.put(is[0], is[2], is[1]);
1527-
if (!visitor.accept_triangle(is[0], is[1], is[2]))
1535+
if (!is_valid(P, is[0], is[1], is[2]))
15281536
{
15291537
// std::cerr << "WARNING: validity, cdt 2 falls back to the original solution!" << std::endl;
15301538
visitor.end_planar_phase(false);

PMP_Mesh_repair/include/CGAL/Polygon_mesh_processing/triangulate_hole.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,6 @@ namespace Polygon_mesh_processing {
5959
constexpr bool accept_triangle(int,int,int) const { return true; }
6060
#endif
6161
};
62-
63-
64-
#ifndef DOXYGEN_RUNNING
65-
// probably not needed if we're using c++17 constexpr
66-
struct Default_user_is_face_valid
67-
{
68-
constexpr
69-
bool accept_triangle( int /* v0 */, int /* v1 */, int /* v2 */) const
70-
{
71-
return true;
72-
}
73-
};
74-
#endif
75-
7662
} // namespace Hole_filling
7763

7864
/*!
@@ -793,6 +779,7 @@ bool use_dt3 =
793779
points,
794780
tracer,
795781
visitor,
782+
is_valid,
796783
choose_parameter<Kernel>(get_parameter(np, internal_np::geom_traits)),
797784
max_squared_distance))
798785
{

PMP_Mesh_repair/test/PMP_Mesh_repair/triangulate_hole_Polyhedron_3_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ struct Hole_filling_visitor
438438
}
439439

440440

441-
bool accept_face(int i0, int i1, int i2) const
441+
bool accept_triangle(int i0, int i1, int i2) const
442442
{
443443
auto a =CGAL::make_array(i0,i1,i2);
444444
std::sort(a.begin(), a.end());
@@ -449,7 +449,7 @@ struct Hole_filling_visitor
449449
struct Hole_filling_visitor_reject_all
450450
: public CGAL::Polygon_mesh_processing::Hole_filling::Default_visitor
451451
{
452-
bool accept_face(int , int , int ) const
452+
bool accept_triangle(int , int , int ) const
453453
{
454454
return false;
455455
}

PMP_Remeshing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,10 @@ class Triangulate_polygon_mesh_modifier
117117
typedef CGAL::Triple<int, int, int> Face_indices;
118118
std::vector<Face_indices> patch;
119119

120-
auto gt_np = parameters::get_parameter(np, internal_np::geom_traits);
121-
auto dt_np = parameters::get_parameter(np, internal_np::use_delaunay_triangulation);
122-
auto threshold_np = parameters::get_parameter(np, internal_np::threshold_distance);
123-
124-
auto new_np = parameters::visitor(visitor)
125-
.use_2d_constrained_delaunay_triangulation(true)
126-
.combine(gt_np, dt_np, threshold_np);
120+
// visitor and bool are "replaced" if they already exist in `np` because we will
121+
// return the first one seen while unstacking the NP inheritance stack
122+
auto new_np = np.visitor(visitor)
123+
.use_2d_constrained_delaunay_triangulation(true);
127124

128125
PMP::triangulate_hole_polyline(hole_points, std::back_inserter(patch), new_np);
129126

STL_Extension/include/CGAL/Named_function_parameters.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -419,19 +419,6 @@ struct Named_function_parameters
419419
return Named_function_parameters<OT, OTag, self>(np.v,*this).combine(nps...);
420420
}
421421

422-
template <typename ... NPS>
423-
auto
424-
combine(internal_np::Param_not_found, const NPS& ... nps) const
425-
{
426-
return this->combine(nps...);
427-
}
428-
429-
auto
430-
combine(internal_np::Param_not_found) const
431-
{
432-
return *this;
433-
}
434-
435422
// typedef for SFINAE
436423
typedef int CGAL_Named_function_parameters_class;
437424
};

0 commit comments

Comments
 (0)