SFCGAL  2.3.0
/tmp/B.oxclwyi3/BUILD/SFCGAL-2.3.0-build/SFCGAL-v2.3.0/src/algorithm/surfaceSimplification.h

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
geometryThe input geometry to simplify (must be a surface or solid)
stopPredicateWhen to stop the simplification process
strategyThe 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
);
// Copyright (c) 2025-2026, SFCGAL Team.
// SPDX-License-Identifier: LGPL-2.0-or-later
#ifndef SFCGAL_ALGORITHM_SURFACE_SIMPLIFICATION_H
#define SFCGAL_ALGORITHM_SURFACE_SIMPLIFICATION_H
#include "SFCGAL/Geometry.h"
#include "SFCGAL/config.h"
#include <memory>
namespace SFCGAL::algorithm {
struct NoValidityCheck;
enum class SimplificationStrategy : unsigned char {
#ifdef SFCGAL_WITH_EIGEN
GARLAND_HECKBERT,
LINDSTROM_TURK
#endif // SFCGAL_WITH_EIGEN
};
struct SimplificationStopPredicate {
enum class PredicateType : unsigned char {
};
double value;
static auto
edgeCount(size_t count) -> SimplificationStopPredicate
{
return {PredicateType::EDGE_COUNT, static_cast<double>(count)};
}
static auto
edgeCountRatio(double ratio) -> SimplificationStopPredicate
{
}
};
[[nodiscard]] SFCGAL_API auto
const Geometry &geometry, const SimplificationStopPredicate &stopPredicate,
-> std::unique_ptr<Geometry>;
[[nodiscard]] SFCGAL_API auto
surfaceSimplification(const Geometry &geometry,
const SimplificationStopPredicate &stopPredicate,
SimplificationStrategy strategy, NoValidityCheck noCheck)
-> std::unique_ptr<Geometry>;
} // namespace SFCGAL::algorithm
#endif // SFCGAL_ALGORITHM_SURFACE_SIMPLIFICATION_H