Skip to content

Releases: SecondMouseAU/OCCTSwiftMesh

v1.1.1 — re-pin OCCTSwift 1.7.1

18 Jun 21:24

Choose a tag to compare

Re-pin OCCTSwift floor to 1.7.1 (OCCT 8.0.0p1, redesigned BRepGraph/TopologyGraph). No API changes; 20 tests pass.

v1.1.0 — Mesh.crossSection planar slicing

12 Jun 10:09

Choose a tag to compare

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)

08 May 12:12
01bd6b1

Choose a tag to compare

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

29 Apr 09:58

Choose a tag to compare

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 — exact targetTriangleCount or targetReduction ratio (mutually exclusive), optional maxHausdorffDistance cap, preserveBoundary for free-edge preservation.
  • Mesh.simplified(_ options:) -> SimplifiedMesh? — failable; returns nil for invalid options or empty inputs.
  • SimplifiedMesh — wraps the decimated Mesh with beforeTriangleCount, afterTriangleCount, and absolute hausdorffDistance in 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 via meshopt_optimizeVertexFetchRemap + remap functions, reports absolute Hausdorff distance via meshopt_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.