Simplify a surface mesh using CGAL edge collapse algorithm.
Simplify a surface mesh using CGAL edge collapse algorithmSimplifies a 3D surface mesh by iteratively collapsing edges while minimizing geometric error. Supports TriangulatedSurface, PolyhedralSurface, Solid, and MultiSolid geometries.
The algorithm uses CGAL's Surface_mesh_simplification package to perform edge collapse operations. The cost and placement of edge collapses are determined by the specified strategy.
- Parameters
-
| geometry | The input geometry to simplify (must be a surface or solid) |
| stopPredicate | When to stop the simplification process |
| strategy | The cost and placement strategy to use (default: EDGE_LENGTH) |
- Returns
- A simplified copy of the input geometry
- Precondition
- The input geometry must be valid and non-empty
-
For EDGE_COUNT_RATIO, the ratio must be in the range (0.0, 1.0)
-
The geometry must be 3-dimensional
- Warning
- Surface geometries (polygon soups) will be converted to CGAL::Surface_mesh, which may modify the topology if the input is not manifold
- See also
- https://doc.cgal.org/latest/Surface_mesh_simplification/index.html#Chapter_Triangulated_Surface_Mesh_Simplification
auto simplified = surfaceSimplification(
polyhedralSurface,
SimplificationStopPredicate::edgeCountRatio(0.5),
SimplificationStrategy::EDGE_LENGTH
);
#ifndef SFCGAL_ALGORITHM_SURFACE_SIMPLIFICATION_H
#define SFCGAL_ALGORITHM_SURFACE_SIMPLIFICATION_H
#include "SFCGAL/Geometry.h"
#include "SFCGAL/config.h"
#include <memory>
struct NoValidityCheck;
#ifdef SFCGAL_WITH_EIGEN
GARLAND_HECKBERT,
LINDSTROM_TURK
#endif
};
struct SimplificationStopPredicate {
};
static auto
edgeCount(
size_t count) -> SimplificationStopPredicate
{
}
static auto
{
}
};
[[nodiscard]] SFCGAL_API auto
const Geometry &geometry, const SimplificationStopPredicate &stopPredicate,
-> std::unique_ptr<Geometry>;
[[nodiscard]] SFCGAL_API auto
const SimplificationStopPredicate &stopPredicate,
-> std::unique_ptr<Geometry>;
}
#endif
Compute the topological boundary of a Geometry.
Definition alphaShapes.cpp:28
auto surfaceSimplification(const Geometry &geometry, const SimplificationStopPredicate &stopPredicate, SimplificationStrategy strategy) -> std::unique_ptr< Geometry >
Simplify a surface mesh using CGAL edge collapse algorithm.
Definition surfaceSimplification.cpp:371
SimplificationStrategy
Strategy for surface mesh simplification cost and placement.
Definition surfaceSimplification.h:31
@ EDGE_LENGTH
Edge Length strategy.
Definition surfaceSimplification.h:48
double value
Target value (count or ratio).
Definition surfaceSimplification.h:120
PredicateType
Type of stop predicate.
Definition surfaceSimplification.h:100
@ EDGE_COUNT_RATIO
Stop when edge count ratio reaches the specified value.
Definition surfaceSimplification.h:116
@ EDGE_COUNT
Stop when edge count reaches the specified value.
Definition surfaceSimplification.h:107
static auto edgeCount(size_t count) -> SimplificationStopPredicate
Create an edge count stop predicate.
Definition surfaceSimplification.h:128
static auto edgeCountRatio(double ratio) -> SimplificationStopPredicate
Create an edge count ratio stop predicate.
Definition surfaceSimplification.h:139
PredicateType type
Type of stop predicate.
Definition surfaceSimplification.h:119