mirror of https://github.com/CGAL/cgal
Make tangential relaxation work with both uniform and adaptive sizing field
This commit is contained in:
parent
cb779038f6
commit
ace36a2bb6
|
|
@ -59,6 +59,7 @@ public:
|
|||
//todo ip: rewrite to remove this?
|
||||
void calc_sizing_map() const {}
|
||||
void update_sizing_map(const vertex_descriptor& vnew) const {}
|
||||
double get_sizing(vertex_descriptor v) const {return 1.;}
|
||||
|
||||
boost::optional<FT> is_too_long(const halfedge_descriptor h) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,7 +75,11 @@
|
|||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Polygon_mesh_processing {
|
||||
|
||||
template <typename PM> class Uniform_sizing_field;
|
||||
|
||||
namespace internal {
|
||||
|
||||
enum Halfedge_status {
|
||||
|
|
@ -1012,7 +1016,7 @@ namespace internal {
|
|||
// "applies an iterative smoothing filter to the mesh.
|
||||
// The vertex movement has to be constrained to the vertex tangent plane [...]
|
||||
// smoothing algorithm with uniform Laplacian weights"
|
||||
template <typename SizingFunction>
|
||||
template <class SizingFunction>
|
||||
void tangential_relaxation_impl(const bool relax_constraints/*1d smoothing*/
|
||||
, const unsigned int nb_iterations
|
||||
, const SizingFunction& sizing)
|
||||
|
|
@ -1046,32 +1050,29 @@ namespace internal {
|
|||
auto constrained_vertices_pmap
|
||||
= boost::make_function_property_map<vertex_descriptor>(vertex_constraint);
|
||||
|
||||
//todo IP temp: I have to rewrite to include original implementation, hardcoded for now
|
||||
const bool use_sizing = true;
|
||||
if (!use_sizing)
|
||||
tangential_relaxation(
|
||||
vertices(mesh_),
|
||||
mesh_,
|
||||
CGAL::parameters::number_of_iterations(nb_iterations)
|
||||
.vertex_point_map(vpmap_)
|
||||
.geom_traits(gt_)
|
||||
.edge_is_constrained_map(constrained_edges_pmap)
|
||||
.vertex_is_constrained_map(constrained_vertices_pmap)
|
||||
.relax_constraints(relax_constraints)
|
||||
);
|
||||
|
||||
if (std::is_same<SizingFunction, Uniform_sizing_field<PM>>::value)
|
||||
tangential_relaxation(
|
||||
vertices(mesh_),
|
||||
mesh_,
|
||||
CGAL::parameters::number_of_iterations(nb_iterations)
|
||||
.vertex_point_map(vpmap_)
|
||||
.geom_traits(gt_)
|
||||
.edge_is_constrained_map(constrained_edges_pmap)
|
||||
.vertex_is_constrained_map(constrained_vertices_pmap)
|
||||
.relax_constraints(relax_constraints)
|
||||
);
|
||||
else
|
||||
tangential_relaxation_with_sizing(
|
||||
vertices(mesh_),
|
||||
mesh_,
|
||||
sizing,
|
||||
CGAL::parameters::number_of_iterations(nb_iterations)
|
||||
.vertex_point_map(vpmap_)
|
||||
.geom_traits(gt_)
|
||||
.edge_is_constrained_map(constrained_edges_pmap)
|
||||
.vertex_is_constrained_map(constrained_vertices_pmap)
|
||||
.relax_constraints(relax_constraints)
|
||||
);
|
||||
tangential_relaxation_with_sizing(
|
||||
vertices(mesh_),
|
||||
mesh_,
|
||||
sizing,
|
||||
CGAL::parameters::number_of_iterations(nb_iterations)
|
||||
.vertex_point_map(vpmap_)
|
||||
.geom_traits(gt_)
|
||||
.edge_is_constrained_map(constrained_edges_pmap)
|
||||
.vertex_is_constrained_map(constrained_vertices_pmap)
|
||||
.relax_constraints(relax_constraints)
|
||||
);
|
||||
|
||||
CGAL_assertion(!input_mesh_is_valid_ || is_valid_polygon_mesh(mesh_));
|
||||
|
||||
|
|
|
|||
|
|
@ -220,27 +220,6 @@ void isotropic_remeshing(const FaceRange& faces
|
|||
np);
|
||||
}
|
||||
|
||||
//todo ip: should I have the overload here?
|
||||
/*
|
||||
template<typename PolygonMesh
|
||||
, typename FaceRange
|
||||
, typename NamedParameters = parameters::Default_named_parameters>
|
||||
void isotropic_remeshing(const FaceRange& faces
|
||||
, const double& tol
|
||||
, const std::pair<double, double>& edge_len_min_max
|
||||
, PolygonMesh& pmesh
|
||||
, const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
typedef Adaptive_sizing_field<PolygonMesh> Adaptive_sizing;
|
||||
Adaptive_sizing sizing(edge_len_min_max, pmesh);
|
||||
isotropic_remeshing<PolygonMesh, FaceRange, Adaptive_sizing, NamedParameters>(
|
||||
faces,
|
||||
sizing,
|
||||
pmesh,
|
||||
np);
|
||||
}
|
||||
*/
|
||||
|
||||
template<typename PolygonMesh
|
||||
, typename FaceRange
|
||||
, typename SizingFunction
|
||||
|
|
@ -355,7 +334,8 @@ void isotropic_remeshing(const FaceRange& faces
|
|||
t.reset(); t.start();
|
||||
#endif
|
||||
|
||||
sizing.calc_sizing_map();
|
||||
sizing.calc_sizing_map();
|
||||
|
||||
for (unsigned int i = 0; i < nb_iterations; ++i)
|
||||
{
|
||||
#ifdef CGAL_PMP_REMESHING_VERBOSE
|
||||
|
|
@ -371,7 +351,6 @@ void isotropic_remeshing(const FaceRange& faces
|
|||
if(do_flip)
|
||||
remesher.flip_edges_for_valence_and_shape();
|
||||
remesher.tangential_relaxation_impl(smoothing_1d, nb_laplacian, sizing);
|
||||
// remesher.tangential_relaxation_impl(smoothing_1d, nb_laplacian);
|
||||
if ( choose_parameter(get_parameter(np, internal_np::do_project), true) )
|
||||
remesher.project_to_surface(get_parameter(np, internal_np::projection_functor));
|
||||
#ifdef CGAL_PMP_REMESHING_VERBOSE
|
||||
|
|
|
|||
|
|
@ -317,14 +317,14 @@ void tangential_relaxation(const VertexRange& vertices,
|
|||
#endif
|
||||
}
|
||||
|
||||
template <typename VertexRange
|
||||
, class TriangleMesh
|
||||
, typename SizingFunction
|
||||
, class NamedParameters = parameters::Default_named_parameters>
|
||||
template <typename VertexRange,
|
||||
class TriangleMesh,
|
||||
class SizingFunction,
|
||||
class NamedParameters = parameters::Default_named_parameters>
|
||||
void tangential_relaxation_with_sizing(const VertexRange& vertices,
|
||||
TriangleMesh& tm,
|
||||
const SizingFunction& sizing,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
TriangleMesh& tm,
|
||||
const SizingFunction& sizing,
|
||||
const NamedParameters& np = parameters::default_values())
|
||||
{
|
||||
typedef typename boost::graph_traits<TriangleMesh>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<TriangleMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
|
|
@ -558,10 +558,12 @@ void tangential_relaxation(TriangleMesh& tm, const CGAL_NP_CLASS& np = parameter
|
|||
tangential_relaxation(vertices(tm), tm, np);
|
||||
}
|
||||
|
||||
template <class TriangleMesh
|
||||
, typename SizingFunction
|
||||
, typename CGAL_NP_TEMPLATE_PARAMETERS>
|
||||
void tangential_relaxation_with_sizing(TriangleMesh& tm, const SizingFunction& sizing, const CGAL_NP_CLASS& np = parameters::default_values())
|
||||
template <class TriangleMesh,
|
||||
typename SizingFunction,
|
||||
typename CGAL_NP_TEMPLATE_PARAMETERS>
|
||||
void tangential_relaxation_with_sizing(TriangleMesh& tm,
|
||||
const SizingFunction& sizing,
|
||||
const CGAL_NP_CLASS& np = parameters::default_values())
|
||||
{
|
||||
tangential_relaxation_with_sizing(vertices(tm), tm, sizing, np);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue