SimplifiedMesh
The successful result of Mesh.simplified(_:): the decimated mesh together with the metadata describing the operation. A Sendable value type. The hausdorffDistance is reported on every successful call, whether or not a maxHausdorffDistance cap was set.
Topics
mesh
The decimated mesh. Orphan vertices left by collapsed edges are already compacted, so its vertexCount is exactly the count of vertices referenced by a surviving triangle.
public let mesh: Mesh
- Example:
guard let result = mesh.simplified(.init(targetReduction: 0.5)) else { return } let reduced: Mesh = result.mesh try reduced.writeSTL(to: outputURL) // OCCTSwift exporter
beforeTriangleCount
Triangle count of the input mesh.
public let beforeTriangleCount: Int
- Example:
print("input had \(result.beforeTriangleCount) triangles")
afterTriangleCount
Triangle count of the output mesh. May exceed the requested target if the algorithm could not reduce further while respecting the maxHausdorffDistance cap or topology preservation — treat the requested target as a soft upper bound.
public let afterTriangleCount: Int
- Example:
if result.afterTriangleCount > 5_000 { print("overshoot — couldn't reach 5000") }
hausdorffDistance
The achieved Hausdorff distance from input to output mesh, in input units (absolute). Reported regardless of whether maxHausdorffDistance was set — read it to understand the decimation quality.
public let hausdorffDistance: Double
- Example:
print("max surface deviation: \(result.hausdorffDistance) units")