Releases: SecondMouseAU/OCCTSwiftMesh
v1.1.1 — re-pin OCCTSwift 1.7.1
v1.1.0 — Mesh.crossSection planar slicing
Adds a 3D-printer-slicer-style mesh slicer: Mesh.crossSection(plane:) intersects a mesh with a plane and recovers the closed contours where it cuts the surface.
- Pure geometry, no OCCT kernel calls — works directly on open / unwelded scan meshes (no B-Rep sewing first).
- A thin-walled tube slices into separate outer + inner loops; wall thickness = their offset. Inner-vs-outer from contour nesting, not triangle winding.
Mesh.crossSections(axis:through:spacing:)produces a full slicer layer stack.
New public API: CutPlane, MeshContour, MeshCrossSection. See CHANGELOG.
v1.0.0 — graduate alongside OCCTSwift 1.0.x (OCCT 8.0.0 GA)
Pure dep bump to graduate alongside OCCTSwift v1.0.0. SemVer-stable from this tag. Pin: from: "1.0.0". Closes #2.
v0.1.0: Mesh.simplified(_:) via vendored meshoptimizer v1.1
v0.1.0 — Mesh.simplified(_:) via vendored meshoptimizer
Initial release. Quadric-error-metric (QEM) mesh decimation backed by meshoptimizer v1.1 (MIT, vendored under Sources/OCCTMeshOptimizer/src/meshoptimizer/).
import OCCTSwift
import OCCTSwiftMesh
let result = mesh.simplified(.init(targetTriangleCount: 5_000))
// → SimplifiedMesh(mesh:, beforeTriangleCount:, afterTriangleCount:, hausdorffDistance:)Public API
Mesh.SimplifyOptions— exacttargetTriangleCountortargetReductionratio (mutually exclusive), optionalmaxHausdorffDistancecap,preserveBoundaryfor free-edge preservation.Mesh.simplified(_ options:) -> SimplifiedMesh?— failable; returnsnilfor invalid options or empty inputs.SimplifiedMesh— wraps the decimatedMeshwithbeforeTriangleCount,afterTriangleCount, and absolutehausdorffDistancein input mesh units.
Bridge ABI (OCCTMeshOptimizer.h)
C entry points exposed for any consumer that wants to operate on raw vertex/index buffers without the OCCTSwift Mesh wrap:
OCCTMeshSimplify— runs the QEM pass, compacts orphan vertices viameshopt_optimizeVertexFetchRemap+ remap functions, reports absolute Hausdorff distance viameshopt_SimplifyErrorAbsolute.OCCTMeshSimplifyFreeResult— releases caller-owned output buffers.OCCTMeshSimplifyScale— bbox-diagonal scale factor for callers that work in relative-error units.
Requirements
- OCCTSwift v0.156.2 or later — needed for the public
Mesh(vertices:normals:indices:)initializer (OCCTSwift#94). - macOS 12+ / iOS 15+, Swift 6, C++17.
Algorithm details
See docs/algorithms/decimation.md for design notes: vertex compaction strategy, Hausdorff units, edge cases (preserveTopology, target overshoot, empty input), performance characteristics, and the vendored-version pin. Re-vendoring procedure in docs/VENDORING.md.
Tests
16 tests in 5 suites — input validation rejection, bridge end-to-end against a sphere mesh, scale function, public API integration (round-trips simplified arrays back through OCCTSwift.Mesh). swift build && swift test clean.
Closes #1.