Merge branch 'SMS-slow_Garland-Heckbert' of github.com:LeoValque/cgal into SMS-slow_Garland-Heckbert

This commit is contained in:
lvalque 2025-10-17 16:47:41 +02:00
commit c2e38c2070
8 changed files with 18 additions and 25 deletions

View File

@ -645,10 +645,10 @@ Release date: July 2023
[`Face_count_ratio_stop_predicate`](https://doc.cgal.org/5.6/Surface_mesh_simplification/classCGAL_1_1Surface__mesh__simplification_1_1Face__count__ratio__stop__predicate.html), [`Face_count_ratio_stop_predicate`](https://doc.cgal.org/5.6/Surface_mesh_simplification/classCGAL_1_1Surface__mesh__simplification_1_1Face__count__ratio__stop__predicate.html),
which can be used to stop the simplification algorithm based on a desired number of faces in the output, or a ratio between input and output face numbers. which can be used to stop the simplification algorithm based on a desired number of faces in the output, or a ratio between input and output face numbers.
- Added the class `CGAL::Surface_mesh_simplification::GarlandHeckbert_plane_and_line_policies`, which provides improved output for `CGAL::Surface_mesh_simplification::edge_collapse`. - Added the class `CGAL::Surface_mesh_simplification::GarlandHeckbert_plane_and_line_policies`, which provides improved output for `CGAL::Surface_mesh_simplification::edge_collapse()`.
That class works the same as previous `GarlandHeckbert_policies`. That class works the same as previous `GarlandHeckbert_policies`.
Its constructor accepts a `Mesh` and optional NamedParameters to set the weight of the line policy relative to the plane policy, set the boundary cost multiplier or provide vertex normals. Its constructor accepts a `Mesh` and optional named parameters to set the weight of the line policy relative to the plane policy, set the boundary cost multiplier or provide vertex normals.
- `CGAL::Surface_mesh_simplification::GarlandHeckbert_policies.h` is now an alias of `CGAL::Surface_mesh_simplification::GarlandHeckbert_plane_and_line_policies.h` and is no longer deprecated. - **Breaking change**: `CGAL::Surface_mesh_simplification::GarlandHeckbert_policies.h` is now an alias of `CGAL::Surface_mesh_simplification::GarlandHeckbert_plane_and_line_policies.h` and is no longer deprecated.
### [2D Regularized Boolean Set Operations](https://doc.cgal.org/5.6/Manual/packages.html#PkgBooleanSetOperations2) ### [2D Regularized Boolean Set Operations](https://doc.cgal.org/5.6/Manual/packages.html#PkgBooleanSetOperations2)
- Exposed all required member functions of the - Exposed all required member functions of the

View File

@ -28,8 +28,6 @@ typedef Kernel::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> Surface_mesh; typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
namespace SMS = CGAL::Surface_mesh_simplification; namespace SMS = CGAL::Surface_mesh_simplification;
namespace PMP = CGAL::Polygon_mesh_processing; namespace PMP = CGAL::Polygon_mesh_processing;
typedef SMS::GarlandHeckbert_plane_policies<Surface_mesh, Kernel> Classic_plane; typedef SMS::GarlandHeckbert_plane_policies<Surface_mesh, Kernel> Classic_plane;
@ -72,7 +70,6 @@ double collapse_gh(Surface_mesh& mesh,
typedef typename GHPolicies::Get_placement GH_placement; typedef typename GHPolicies::Get_placement GH_placement;
typedef SMS::Bounded_normal_change_filter<> Filter; typedef SMS::Bounded_normal_change_filter<> Filter;
// GHPolicies gh_policies(mesh);
const GH_cost& gh_cost = gh_policies.get_cost(); const GH_cost& gh_cost = gh_policies.get_cost();
const GH_placement& gh_placement = gh_policies.get_placement(); const GH_placement& gh_placement = gh_policies.get_placement();
@ -83,9 +80,10 @@ double collapse_gh(Surface_mesh& mesh,
return (std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count()) / 1000.; return (std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time).count()) / 1000.;
} }
std::string getFileNameWithoutExtension(const std::string& filePath) { std::string getFileNameWithoutExtension(const std::string& filePath)
std::filesystem::path path(filePath); {
return path.stem().string(); // 'stem' gets the filename without extension std::filesystem::path path(filePath);
return path.stem().string(); // 'stem' gets the filename without extension
} }
int main(int argc, char** argv) int main(int argc, char** argv)

View File

@ -5,12 +5,12 @@ namespace Surface_mesh_simplification {
\ingroup PkgSurfaceMeshSimplificationRef \ingroup PkgSurfaceMeshSimplificationRef
The class `GarlandHeckbert_plane_and_line_policies` regroups the cost and placement policies The class `GarlandHeckbert_plane_and_line_policies` regroups the cost and placement policies
based on the Garland-Heckbert "Plane and line" strategy of Liu and colleagues \cgalCite{liu2025linequadrics} based on the Garland-Heckbert "Plane and line" strategy of Liu and colleagues \cgalCite{liu2025linequadrics}.
This policy enhances the original Garland-Heckbert quadric error metrics, This policy enhances the original Garland-Heckbert quadric error metrics
by adding to the cost the distance to the line passing through the input vertices and aligned with their normals. by adding to the cost the distance to the line passing through the input vertices and aligned with their normals.
Compared to the "classic" plane strategy, this strategy improves the speed and the quality of the result. Compared to the "classic" plane strategy, this strategy improves the speed and the quality of the result
(Section \ref SurfaceMeshSimplificationGarlandHeckbertStrategy). (see Section \ref SurfaceMeshSimplificationGarlandHeckbertStrategy).
\note Both the cost and the placement policies must be used together as they internally use \note Both the cost and the placement policies must be used together as they internally use
and share information associating quadrics to vertices. and share information associating quadrics to vertices.
@ -50,6 +50,7 @@ public:
\param tmesh the triangle mesh \param tmesh the triangle mesh
\param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below
\cgalNamedParamsBegin \cgalNamedParamsBegin
\cgalParamNBegin{vertex_normal_map} \cgalParamNBegin{vertex_normal_map}
\cgalParamDescription{a property map associating to each vertex of `tmesh` a normal direction for that vertex} \cgalParamDescription{a property map associating to each vertex of `tmesh` a normal direction for that vertex}
@ -57,20 +58,17 @@ public:
as key type and `Vector_3` as value type} as key type and `Vector_3` as value type}
\cgalParamDefault{an internal map filled using `CGAL::Polygon_mesh_processing::compute_vertex_normals`} \cgalParamDefault{an internal map filled using `CGAL::Polygon_mesh_processing::compute_vertex_normals`}
\cgalParamNEnd \cgalParamNEnd
\cgalParamNBegin{discontinuity_multiplier} \cgalParamNBegin{discontinuity_multiplier}
\cgalParamDescription{a multiplier of the error value for boundary edges to preserve the boundaries} \cgalParamDescription{a multiplier of the error value for boundary edges to preserve the boundaries}
\cgalParamType{double} \cgalParamType{double}
\cgalParamDefault{100} \cgalParamDefault{100}
\cgalParamNEnd \cgalParamNEnd
\cgalParamNBegin{line_policies_weight} \cgalParamNBegin{line_policies_weight}
\cgalParamDescription{a value that define the weight of the line policies compare to the plane policies} \cgalParamDescription{a value that defines the weight of the line policies compared to the plane policies}
\cgalParamType{double} \cgalParamType{double}
\cgalParamDefault{0.01} \cgalParamDefault{0.01}
\cgalParamNEnd \cgalParamNEnd
\cgalNamedParamsEnd \cgalNamedParamsEnd
*/ */
template<typename NamedParameters = parameters::Default_named_parameters> template<typename NamedParameters = parameters::Default_named_parameters>
GarlandHeckbert_plane_and_line_policies(TriangleMesh& tmesh, const NamedParameters &np = parameters::default_values()); GarlandHeckbert_plane_and_line_policies(TriangleMesh& tmesh, const NamedParameters &np = parameters::default_values());
@ -88,7 +86,7 @@ public:
}; };
/*! /*!
Creates a Garland-Heckbert plane and line policies object creates a Garland-Heckbert plane and line policies object.
*/ */
template<typename TriangleMesh, typename NamedParameters = parameters::Default_named_parameters> template<typename TriangleMesh, typename NamedParameters = parameters::Default_named_parameters>
GarlandHeckbert_plane_and_line_policies make_GarlandHeckbert_plane_and_line_policies(TriangleMesh& tmesh, GarlandHeckbert_plane_and_line_policies make_GarlandHeckbert_plane_and_line_policies(TriangleMesh& tmesh,

View File

@ -5,7 +5,7 @@ namespace Surface_mesh_simplification {
\ingroup PkgSurfaceMeshSimplificationRef \ingroup PkgSurfaceMeshSimplificationRef
This class is an alias for the current state-of-the-art Garland-Heckbert policies This class is an alias for the current state-of-the-art Garland-Heckbert policies
(Section \ref SurfaceMeshSimplificationGarlandHeckbertStrategy). (see Section \ref SurfaceMeshSimplificationGarlandHeckbertStrategy).
It is currently an alias of `GarlandHeckbert_plane_and_line_policies`. It is currently an alias of `GarlandHeckbert_plane_and_line_policies`.
\sa `GarlandHeckbert_plane_policies` \sa `GarlandHeckbert_plane_policies`

View File

@ -2,5 +2,5 @@
PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - Triangulated Surface Mesh Simplification" PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - Triangulated Surface Mesh Simplification"
HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/sappho.png HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/sappho.png \
HTML_EXTRA_FILES = ${CGAL_PACKAGE_DOC_DIR}/fig/octocat.png ${CGAL_PACKAGE_DOC_DIR}/fig/octocat.png

View File

@ -43,7 +43,7 @@ struct GH_helper{
NamedParameters, NamedParameters,
Vertex_normal_dmap>::type Vertex_normal_map; Vertex_normal_dmap>::type Vertex_normal_map;
const NamedParameters &np; NamedParameters np;
GH_helper(const NamedParameters &np_):np(np_){ } GH_helper(const NamedParameters &np_):np(np_){ }
Vertex_normal_map vnm(TriangleMesh& tmesh) const{ Vertex_normal_map vnm(TriangleMesh& tmesh) const{

View File

@ -25,9 +25,7 @@ namespace internal {
This policy was created to combine the line policy with the existing ones. This policy was created to combine the line policy with the existing ones.
The composition of some quadrics is always invertible, but this is not necessarily true for all composed quadrics. The composition of some quadrics is always invertible, but this is not necessarily true for all composed quadrics.
`invertible` boolean parameter reflects this distinction. `invertible` boolean parameter reflects this distinction.
*/ */
template <typename TriangleMesh, typename GeomTraits, typename Quadric_calculator_1, typename Quadric_calculator_2, bool invertible=false> template <typename TriangleMesh, typename GeomTraits, typename Quadric_calculator_1, typename Quadric_calculator_2, bool invertible=false>
class Composed_quadric_calculator class Composed_quadric_calculator
{ {

View File

@ -31,7 +31,6 @@ namespace internal {
This policy is not useful on its own; it is designed to be combined with another policy using a small weight. This policy is not useful on its own; it is designed to be combined with another policy using a small weight.
Therefore, it is kept internal. Therefore, it is kept internal.
*/ */
template <typename TriangleMesh, typename GeomTraits> template <typename TriangleMesh, typename GeomTraits>
class Line_quadric_calculator class Line_quadric_calculator
{ {