mirror of https://github.com/CGAL/cgal
Apply suggestions from code review
Co-authored-by: Mael <mael.rouxel.labbe@geometryfactory.com> Co-authored-by: Andreas Fabri <andreas.fabri@geometryfactory.com>
This commit is contained in:
parent
25aa21635a
commit
c8110a71eb
|
|
@ -89,9 +89,6 @@ std::string getFileNameWithoutExtension(const std::string& filePath) {
|
||||||
return path.stem().string(); // 'stem' gets the filename without extension
|
return path.stem().string(); // 'stem' gets the filename without extension
|
||||||
}
|
}
|
||||||
|
|
||||||
// Usage:
|
|
||||||
// ./command [input] [ratio] [policy] [output]
|
|
||||||
// policy can be "cp" (classic plane), "ct" (classic triangle), "pp" (probabilistic plane), "pt" (probabilistic triangle)
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
Surface_mesh mesh;
|
Surface_mesh mesh;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ namespace Surface_mesh_simplification {
|
||||||
/*!
|
/*!
|
||||||
\ingroup PkgSurfaceMeshSimplificationRef
|
\ingroup PkgSurfaceMeshSimplificationRef
|
||||||
|
|
||||||
since \cgal 6.2, this class is an alias for the current state of the art of Garland-Heckbert policies
|
This class is an alias for the current state-of-the-art Garland-Heckbert policies
|
||||||
(Section \ref SurfaceMeshSimplificationGarlandHeckbertStrategy).
|
(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`.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,11 +188,11 @@ face normals). This variance naturally deteriorates the tightness of the result,
|
||||||
hand it enables creating more uniform triangulations and the approach is more tolerant to noise,
|
hand it enables creating more uniform triangulations and the approach is more tolerant to noise,
|
||||||
while still maintaining feature sensitivity.
|
while still maintaining feature sensitivity.
|
||||||
|
|
||||||
Another extension of the Garland–Heckbert approach was introduced by Liu et al. \cgalCite{10.1111:cgf.70184}, who
|
Another extension of the Garland–Heckbert approach was introduced by Liu et al. \cgalCite{10.1111:cgf.70184},
|
||||||
proposed the concept of line quadrics. In these quadrics, the cost is defined as the distance to the line passing
|
who enhance the classic plane-based quadric error metrics with line quadrics.
|
||||||
through the input vertices and aligned with their normals. These line quadrics are combined with the traditional
|
More precisely, line quadrics, which encode the distance to a line, are defined at all input vertices using the supporting lines of the normals.
|
||||||
plane quadrics, but with a small weight (0.01 by default), producing more uniform triangulations while preserving
|
These quadrics are then combined with the classic plane quadrics, but with a small weight (0.01 by default).
|
||||||
the tightness of the approximation.
|
This results in more uniform triangulations, while preserving the tightness of the approximation.
|
||||||
|
|
||||||
\cgalFigureAnchor{SurfaceMeshSimplification_GH}
|
\cgalFigureAnchor{SurfaceMeshSimplification_GH}
|
||||||
<center>
|
<center>
|
||||||
|
|
@ -406,7 +406,7 @@ steps of the simplification algorithm.
|
||||||
|
|
||||||
Each Garland-Heckbert simplification strategy is implemented with a single class that regroups
|
Each Garland-Heckbert simplification strategy is implemented with a single class that regroups
|
||||||
both the cost and the placement policies, which must be used together as they share vertex quadric data.
|
both the cost and the placement policies, which must be used together as they share vertex quadric data.
|
||||||
The state of the art strategy of using plane-based quadric error metrics plus line-base quadric error metrics is implemented with the class
|
The state-of-the-art strategy of combining plane and line-based quadric error metrics is implemented with the class
|
||||||
`Surface_mesh_simplification::GarlandHeckbert_policies`.
|
`Surface_mesh_simplification::GarlandHeckbert_policies`.
|
||||||
Although both policies must be used together, it is still possible to wrap either policy
|
Although both policies must be used together, it is still possible to wrap either policy
|
||||||
using behavior modifiers such as `Surface_mesh_simplification::Bounded_normal_change_placement`.
|
using behavior modifiers such as `Surface_mesh_simplification::Bounded_normal_change_placement`.
|
||||||
|
|
@ -426,7 +426,7 @@ The implementation of the Garland-Heckbert simplification policies is the result
|
||||||
of Baskın Şenbaşlar (Google Summer of Code 2019), and Julian Komaromy (Google Summer of Code 2021)
|
of Baskın Şenbaşlar (Google Summer of Code 2019), and Julian Komaromy (Google Summer of Code 2021)
|
||||||
They both were mentored by Mael Rouxel-Labbé, who also contributed to the code and to the documentation.
|
They both were mentored by Mael Rouxel-Labbé, who also contributed to the code and to the documentation.
|
||||||
|
|
||||||
Léo Valque added the `GarlandHeckbert_plane_and_line_policies` functionality in \cgal 6.2.
|
Léo Valque added the `Surface_mesh_simplification::GarlandHeckbert_plane_and_line_policies` functionality in \cgal 6.2.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
} /* namespace CGAL */
|
} /* namespace CGAL */
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GarlandHeckbert_plane_and_line_policies(TriangleMesh& tmesh,
|
GarlandHeckbert_plane_and_line_policies(TriangleMesh& tmesh,
|
||||||
const FT line_weight=FT(0.01),
|
const FT line_weight = FT(0.01),
|
||||||
const FT dm = FT(100))
|
const FT dm = FT(100))
|
||||||
: Base(tmesh, FT(1.)/line_weight, dm)
|
: Base(tmesh, FT(1.)/line_weight, dm)
|
||||||
{ }
|
{ }
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,9 @@ class GarlandHeckbert_composed_policies
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef internal::Composed_quadric_calculator<TriangleMesh, GeomTraits,
|
typedef internal::Composed_quadric_calculator<TriangleMesh, GeomTraits,
|
||||||
typename GH_policies_1::Quadric_calculator,
|
typename GH_policies_1::Quadric_calculator,
|
||||||
typename GH_policies_2::Quadric_calculator,
|
typename GH_policies_2::Quadric_calculator,
|
||||||
invertible>
|
invertible>
|
||||||
Quadric_calculator;
|
Quadric_calculator;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -280,8 +280,8 @@ construct_optimal_point_singular(const typename GarlandHeckbert_matrix_types<Geo
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
Note:
|
Note:
|
||||||
A simpler code for the case of an not invertible matrix
|
A simpler code for the case of a non-invertible matrix
|
||||||
Experiments that the results is identical to above in the majority of the cases and nearly identical runtime
|
Experiments show that the results are identical to the version above in the majority of the cases, and nearly identical runtime
|
||||||
Therefore old case was kept.
|
Therefore old case was kept.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -550,9 +550,9 @@ construct_line_quadric_from_normal(const typename GeomTraits::Vector_3& normal,
|
||||||
auto c_point = gt.construct_point_3_object();
|
auto c_point = gt.construct_point_3_object();
|
||||||
auto base= gt.construct_base_vector_3_object();
|
auto base= gt.construct_base_vector_3_object();
|
||||||
|
|
||||||
Vector_3 x=base(plane(c_point(0,0,0),normal), 1);
|
Vector_3 x = base(plane(c_point(0,0,0),normal), 1);
|
||||||
CGAL::Polygon_mesh_processing::internal::normalize(x, gt);
|
CGAL::Polygon_mesh_processing::internal::normalize(x, gt);
|
||||||
Vector_3 y=cp(x,normal);
|
Vector_3 y = cp(x,normal);
|
||||||
|
|
||||||
return construct_classic_plane_quadric_from_normal(x, point, gt)+construct_classic_plane_quadric_from_normal(y, point, gt);
|
return construct_classic_plane_quadric_from_normal(x, point, gt)+construct_classic_plane_quadric_from_normal(y, point, gt);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ typedef SMS::GarlandHeckbert_plane_policies<Surface_mesh, Kernel>
|
||||||
typedef SMS::GarlandHeckbert_probabilistic_plane_policies<Surface_mesh, Kernel> Prob_plane;
|
typedef SMS::GarlandHeckbert_probabilistic_plane_policies<Surface_mesh, Kernel> Prob_plane;
|
||||||
typedef SMS::GarlandHeckbert_triangle_policies<Surface_mesh, Kernel> Classic_tri;
|
typedef SMS::GarlandHeckbert_triangle_policies<Surface_mesh, Kernel> Classic_tri;
|
||||||
typedef SMS::GarlandHeckbert_probabilistic_triangle_policies<Surface_mesh, Kernel> Prob_tri;
|
typedef SMS::GarlandHeckbert_probabilistic_triangle_policies<Surface_mesh, Kernel> Prob_tri;
|
||||||
typedef SMS::GarlandHeckbert_plane_and_line_policies<Surface_mesh, Kernel> Classic_plane_and_line;
|
typedef SMS::GarlandHeckbert_plane_and_line_policies<Surface_mesh, Kernel> Classic_plane_and_line;
|
||||||
|
|
||||||
// settings for benchmarking - throw away the first n_burns results and keep the n_samples samples
|
// settings for benchmarking - throw away the first n_burns results and keep the n_samples samples
|
||||||
constexpr int n_burns = 1;
|
constexpr int n_burns = 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue