47 Commits
Author SHA1 Message Date
Emmett Lalish 7b33277245 Remove duplicate Smoothing APIs (#1814)
* almost updated scallop

* scallop working

* fixed scallop

* sharpened scallop

* removed some smoothing APIs

* fixed some tests

* tests passing

* updated bindings examples

* fix formatting

* fix more formatting
2026-09-07 12:44:38 +12:00
Zach Loafman c50001b82d Add CrossSection::EvenOdd for even-odd input fill (#1788) 2026-08-10 21:10:21 +12:00
Zach LoafmanandClaude Sonnet 4.6 bf47ebccc6 CrossSection: drop FillRule/Compose, add SetTolerance/GetTolerance (#1760)
* CrossSection API break (#1707): drop FillRule/Compose, const-ref Hull, tolerance API

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* CrossSection API break (#1707): C bindings + test fixes

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* CrossSection API break (#1707): Python + WASM bindings

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* CrossSection API break (#1707): doc + example followups

- Drop stale @param fillrule from CrossSection(SimplePolygon) doc
- Replace CrossSection.compose with batch_boolean in all_apis.py
- Add get_tolerance/set_tolerance to all_apis.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* CrossSection API break (#1707): fix WASM JoinType::Bevel

'Bevel' was registered in the embind enum but missing from the
TypeScript type and from joinTypeToInt(), so passing 'Bevel' silently
fell through to 'Square' (0). Add it to both.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* CrossSection API break (#1707): tolerance API fixups

- Rect and Circle constructors now set tolerance_ via InferEps,
  consistent with the Polygons constructor. Previously GetTolerance()
  returned 0 for these paths.
- Hull(const SimplePolygon&): use the local sorted copy (points) for
  InferEps, not the original const-ref (pts).
- Move SetTolerance declaration to the Information doxygen group
  alongside GetTolerance.
- Add CBIND.cross_section_tolerance smoke test for
  manifold_cross_section_get/set_tolerance.
- Fix stale comment in SimplifyPostFiltersBoolean2Output referencing
  the old epsilon=1e-6 default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* CrossSection API break (#1707): fix WASM compose/voronoi, doc Simplify default

- Remove 'compose' from crossSectionStaticFunctions in garbage-collector.ts
  (CrossSection.compose no longer exists; wrapping undefined crashed with
  "originalFn is not a function" in WASM TBB:OFF CI lanes)
- Add 'setTolerance' to crossSectionMemberFunctions (returns new CrossSection)
- Update voronoi.mjs to use CrossSection.union() instead of .compose()
- Fix stale @param epsilon / default 1e-6 in manifold-encapsulated-types.d.ts
  (parameter is now 'tolerance', default 0 uses the geometry's own tolerance)
- Add @param doc note to CrossSection::Simplify explaining that default 0
  resolves to tolerance_ (geometry-scale-derived, not a fixed 1e-6)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 21:00:22 +12:00
Zach LoafmanandClaude Opus 4.8 e02471d211 Expose ExecutionContext factories in bindings (C/Python/WASM) (#1743)
The ctx-aware static factories (FromMeshGL / LevelSet / Smooth) had no
binding, so ops with no source Manifold to attach via WithContext - notably
MeshGL ingest - could not be observed or cancelled from the language
bindings. The ExecutionContext object and WithContext were already bound;
this adds the three factories as methods on the context, mirroring the plain
static factories.

- C: manifold_execution_context_{level_set,level_set_seq,of_meshgl,
  of_meshgl64,smooth,smooth64}. The level_set helper is generalized to run
  under an ExecutionContext; the SDF callback user-data is renamed sdf_context
  to keep it distinct from the ExecutionContext argument.
- Python: ExecutionContext.{from_mesh,level_set,smooth} mirroring the
  Manifold static-factory lambdas.
- WASM: ExecutionContext.{fromMesh,smooth,levelSet} (embind helpers in
  helpers.cpp, JS wrappers in bindings.js, .d.ts declarations).

Tests: CBIND.execution_context_factories (C), all_apis.py coverage (Python),
and an ExecutionContext-static-factories case (WASM). All build and pass
locally across the three layers.

Toward #971.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 20:50:45 +12:00
Zach LoafmanandClaude Opus 4.7 8606a8281d Attach ExecutionContext to Manifold; remove per-call Status(ctx) (#1704)
* Attach ExecutionContext to Manifold; remove per-call Status(ctx) variant

Replaces the per-call ExecutionContext parameter on Status() with a
data-attachment model: WithContext(ctx) returns a copy of the Manifold
with the context attached, and the no-arg Status() routes through any
attached context. Subsequent operations on the attached Manifold (and
the Manifolds they derive) inherit the attachment, so Translate,
Boolean, Hull and friends observe progress and cancellation without
needing extra parameters.

The attachment travels with the data: copying propagates it, and ops
returning a Manifold inherit from the primary operand (`*this` for
member ops, `manifolds[0]` for the static factories that combine
multiple Manifolds). WithoutContext() detaches; GetContext() returns
the attached context as std::optional<ExecutionContext> sharing state
with the original.

Removes the explicit Status(ExecutionContext&) overload from C++ and
its matching forms in the C / Python / WASM bindings
(manifold_status_with_context, .def("status", ctx), statusWithContext)
in favour of attach-then-Status(). Refine variants are left untouched
in this commit; that's the next one.

* Refine: route attached ExecutionContext through Subdivide post-pass (#1702)

The motivating example for per-call ctx parameters (PR #1702) was
mid-Refine cancellation. With ExecutionContext now attached to the
Manifold, that need can be served without changing public signatures.

Adds an optional ctx parameter to Manifold::Impl::Refine and threads
the cancel check between Subdivide and the post-pass
(SetNormalsAndCoplanar / CalculateVertNormals / SortGeometry), routing
SortGeometry through its existing ctx-aware overload. The public
Refine, RefineToLength and RefineToTolerance variants pass ctx_.get()
both into GetCsgLeafNode (input-tree evaluation) and into Impl::Refine
(post-Subdivide work).

Subdivide itself stays cancel-blind for now; the cancellation point is
at the granularity of "after Subdivide returns", which matches how
other ops in the codebase observe cancellation around their hot kernel.

* Refactor: collapse construct+inherit pattern into Derived() helper

Member ops returning a derived Manifold previously did:
    Manifold result(...);
    result.InheritContextFrom(*this);
    return result;

Replace with a templated private helper `Derived(T&& arg)` that
forwards `arg` to the appropriate Manifold ctor and inherits the
attached ExecutionContext from `*this`. Static factories that combine
multiple Manifolds use the lvalue form, e.g. `manifolds[0].Derived(...)`.

Templated to forward through shared_ptr-of-derived-CsgNode (e.g.
shared_ptr<CsgLeafNode>) which would otherwise need two user-defined
conversions to reach Manifold.

No behavior change. Saves ~40 lines across 17 call sites.

* Pivot ExecutionContext attach to "eager-reads-input, deferred-drops"

Per #1704 review: ctx is consumed only by the next eager op invoked
on the result (Status, Refine family). Deferred ops (Boolean,
transforms, batch ops) ignore any attached ctx; their result has no
ctx. Raw copy/assignment preserves the attachment.

Public surface trimmed to one method per binding (C++ With,
manifold_with_context, with_context, withContext); WithoutContext /
HasContext / GetContext and their mirrors are dropped -- under the
new model the user always knows what ctx they attached, so
introspection has no real use case. Internal Derived() helper and
InheritContextFrom go with the inheritance step; call sites use
plain Manifold(...) construction.

Test flips: deferred ops drop input ctx; Refine result has no ctx;
copy/assignment preservation checked behaviorally via Status()
routing rather than HasContext.

395/395 pass (was 397; net -2 dropped + 1 new test for the
(a+b).With(ctx).Status() idiom).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Cleanups around ExecutionContext attach

- Fix `Manifold(Manifold())` wart in `Mirror`'s degenerate-normal branch
  (search-and-replace leftover from collapsing the old `Derived(...)`
  helper into plain `Manifold(...)` construction). Should be just
  `Manifold()`.
- Remove dead `ExecutionContext(std::shared_ptr<Impl>)` ctor: it was
  used by the now-removed `GetContext()`. No live callers.
- Tighten the `With(ctx)` docstring to explicitly close the list of
  ctx-observing ops -- `Volume` / `GetMeshGL` / `BoundingBox` etc.
  force evaluation but do not currently observe attached ctx. The
  previous wording was positive-only and could mislead a casual reader.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Rename C++ `With` -> `WithContext` to match bindings

The bindings use `with_context` (C, Python) / `withContext` (WASM); the
C++ method had been the asymmetric shorter `With` on the rationale that
C++ overload resolution future-proofs the verb. Per Emmett's review on
#1704, the consistency tradeoff is small enough that matching the
bindings is the cleaner outcome.

Mechanical rename across 8 files (header decl, impl, bindings, tests,
docstring prose). No semantic changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Drop redundant Manifold(...) wrap around Minkowski return

`Impl::Minkowski` already returns a `Manifold`; wrapping it just invokes
the move ctor with no effect. Sed leftover from collapsing the old
`Derived(...)` helper into plain `Manifold(...)` construction. Same
class as the earlier Mirror fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 08:36:24 +12:00
Zach LoafmanandClaude Opus 4.7 adaf64c4a7 Add ExecutionContext language bindings (#1668)
* Add ExecutionContext language bindings

Mirrors the C++ ExecutionContext API (from #1663) in the C, Python, and
WASM bindings:

- C: opaque ManifoldExecutionContext with manifold_execution_context{,_
  cancel,_cancelled,_progress} and manifold_status_with_context; full
  size/alloc/destruct/delete plumbing.
- Python: ExecutionContext class with cancel/cancelled/progress; Status
  overload via nanobind overload dispatch.
- WASM: ExecutionContext embind class with the same methods; new
  Manifold.statusWithContext(ctx) that delegates to a shared
  ErrorToString helper (and adds the previously-missing Cancelled case).

Tests: C API round-trip (alloc, cancel, status-with-context); WASM
vitest smoke. Python smoke verified locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Clarify ExecutionContext.delete() docstring

Matches the existing wording used on Manifold.delete() and
CrossSection.delete(). Addresses review confusion on #1668.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Match ExecutionContext.delete() framing to peer APIs

Add "// Memory" section comment and @group Basics tag to match the
shape of Manifold.delete() and CrossSection.delete(). Follow-up to
elalish's comment on #1668 — the docstring wording was updated in
992bca54, but the surrounding framing still made delete() look like
an afterthought.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Add real Python cancel assertion to all_apis.py

The pre-existing ExecutionContext block in all_apis.py was a smoke test
only — it called cancel()/status(ctx) on a leaf node (which skips CSG
evaluation entirely) and didn't assert the result. Add an assertion
using a CsgOpNode (Manifold.cube() + Manifold.sphere(1)) so a
regression in the Python status(ctx) overload — like the nanobind
overload-resolution break that tripped CI once during #1668 dev —
would actually fail the test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 14:02:20 +12:00
301c165a20 Add MinkowskiSum and MinkowskiDifference (#666)
* Add Naive Minkowski Sum Implementation

* Fix CI Bellyaching

* Add Python Minkowski Test

* Enable Determinism for the Failing CI Tests

* Fix Python Test

* Fix Python Test Again

* Make Python Test Cheaper so it doesn't segfault

* Add Insetting Option

* Update Python Binding Too

* Switch to a Member Function

* Remove the useThreading option

* Fix the Python Binding

* And the example

* Fix Formatting

* Split into Add/Subtract Functions, Add C Binding

* Make Methods const

* Update the tests; ensure that the inset operation works with convex shapes

* Fix Python Example Again

* Add JS Bindings

* Fix Formatting

* Fix Formatting Properly

* Change Function Names to Sum/Difference

* Fix formatting

* Move Tests to boolean_test

* Fix Formatting

* Fix NonConvexConvex Test

* Fix Formatting

* Add Surface Area

* passing the last test

* forgot these

* Fix Test?

* Fix for  Disconnected Manifolds

* Codify IsConvex, Make Python Cheaper

* Refactor to use Impl

* Remove Dangling Line Return

* Add another early exit

* Fix Glaring Bugs...

* Fix Formatting

* Again

* Fix Mesh Export

* Run SimplifyTopology on the output of Minkowski

* Update Tests

* Update Formatting

* Make more work multithreaded

* Fix formatting

* Disable test cheating?

* Revert "Disable test cheating?"

This reverts commit d1f35e2668bea54aec87727b3e8c8bce5ac0ebe4.

* Update to latest code

* Fix Formatting

* Break out the Convex/Convex MDifference

I just realized what was supposed to be a simple test was actually two tests, one with more complexity than the other...

* Fix Formatting

* Fix Formatting

* Relax Minkowski test tolerances for cross-platform consistency

The NonConvexConvexMinkowski and NonConvexNonConvexMinkowski tests had
tight tolerances (1e-5) that fail due to minor numerical variations
across platforms. Widened surface area tolerances to 1e-2 and volume
tolerances to 1e-3 to account for triangulation differences.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix Minkowski test CI failures

- Add processOverlaps=true to ConvexConvexMinkowskiD to handle
  duplicate/collinear points in triangulation
- Disable NonConvexNonConvexMinkowski test - produces non-manifold
  results on some platforms due to coplanar face handling issues
  in the naive Minkowski implementation (see issue #1430)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Re-enable NonConvexNonConvexMinkowski test

Re-enabled the test to properly debug the MinkowskiSum behavior
with coplanar faces from non-convex inputs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix MinkowskiDifference hang with tolerance-based coplanarity check

- Split NonConvexNonConvexMinkowski test into separate Sum and Difference tests
- Use tolerance-based coplanarity check (1e-15) instead of exact equality
  to handle floating-point precision issues from scaling operations
- Update test expected values to more precise measurements with 1e-5 tolerance
- Use ManifoldParamGuard for RAII-style parameter management in tests

The coplanarity check now uses dot product comparison instead of exact
floating-point equality (linalg::equal), which was failing for scaled
normals due to precision issues. The dot product of parallel unit vectors
should be 1.0, so we check if |dot - 1.0| < 1e-15 (near machine epsilon).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address PR review feedback for Minkowski implementation

- Move IsConvex() from edge_op.cpp to properties.cpp for better organization
- Fix data race in IsConvex() by using all_of instead of for_each_n with
  shared anyConcave boolean (UB per pca006132's review)
- Remove unnecessary pImpl variable in IsConvex, use this directly
- Simplify convexity check to use > 0 instead of tolerance parameter
- Split NonConvexConvexMinkowski test into Sum and Difference for consistency
  with NonConvexNonConvex tests
- Add analytical volume/surface area formulas for ConvexConvex tests
- Truncate excessive precision in test expected values

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Run clang-format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Move Minkowski implementation from Manifold to Impl

- Add Impl::Minkowski method in impl.cpp with batch processing optimization
- Manifold::Minkowski now delegates to Impl::Minkowski
- This is more consistent with the codebase style and avoids repeated
  GetCsgLeafNode().GetImpl() calls
- Includes BATCH_SIZE=1000 optimization for hull operations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add parallelization to NonConvex-NonConvex Minkowski case

- Flatten nested face pair loops into single index space
- Process pairs in parallel batches using for_each_n
- Use validHull flag array to handle coplanar face filtering
- Collect valid hulls after parallel execution for BatchBoolean

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Run clang-format

* Use periodic batch reduction for NC-NC Minkowski to handle large meshes

Replace face-pair batching with per-A-face processing and periodic
reduction every 200 faces. This approach:
- Processes A faces sequentially, creating B-face hulls in parallel
- Merges accumulated results every REDUCE_THRESHOLD faces
- Prevents memory from growing unboundedly with large meshes

Enables complex meshes like spoon (904 tris) to complete without
crashing while maintaining similar performance for smaller meshes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address review feedback from PR #666

- Pre-allocate composedHulls vector
- Simplify validHulls loop by checking IsEmpty() instead of separate bool vector
- Add surface area check to ConvexConvexMinkowski test
- Remove private Minkowski wrapper function, call Impl directly
- Add performance warning to MinkowskiSum/MinkowskiDifference docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Increase coplanarity tolerance in NC-NC Minkowski sum

Increase kCoplanarTol from 1e-15 to 1e-9 to more reliably skip
nearly-coplanar face pairs that could cause degenerate hull
computations and potential hangs.

This tolerance is conservative enough to skip genuinely coplanar
faces while still allowing valid near-coplanar face pairs to be
processed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Emmett Lalish <elalish@google.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 11:11:23 +13:00
Jonathan Hogg 3a83b83ca3 Add missing Manifold.simplify() method to Python API (#1282)
Add missing Manifold.simplify() method to Python API (#1281)

* add binding to manifold3d.cpp

* add test call in all_apis.py
2025-06-10 17:10:34 +08:00
Emmett Lalish 2cf3dfd0ec default offset to round (#1257) 2025-05-14 02:17:50 -07:00
Emmett Lalishandpca006132 954df798b2 New decimator (#1175)
* merging

* mostly working

* implemented, but crashes

* runs serially

* fix compile issues

* fixed empty meshes

* fix parallel error dumping

* fixed parallelization

* fix compiler

* run black

* improved triangulation

* remove unreferenced verts

* addressing feedback

---------

Co-authored-by: pca006132 <john.lck40@gmail.com>
2025-03-05 20:42:39 -08:00
pca006132 f11ed8da6c bindings update (#1018)
* bindings: add MeshGL64 C bindings

* bindings: fix leak and address sanitizer issue

* bindings: add Mesh64 to python

* bindings: fix c binding 64 bit index type

* bindings: fix python 64 bit index type

* bindings: fix python again

* bindings: formatting
2024-11-02 13:59:12 +08:00
Emmett Lalish 80221a3511 Precision renaming (#1008)
* rename refineToPrecision

* rename kTolerance

* the precision rename
2024-10-22 15:28:09 -07:00
pca006132 5ba3c24112 [WIP] Add tolerance value (#997)
* renaming precision to uncertainty, and hiding

* add tolerance

* rename uncertainty to epsilon

* use epsilon instead of tolerance

* guard simplify topology for SetEpsilon

* format

* remove conflict markers

* fix builds

* use epsilon for barycentric

* prefer using epsilon

* update python bindings

* address comments

* format

* remove SetTolerance

Tolerance value is set before the mesh is created, when SimplfiyTopology
cannot be called.

* read/write MeshGL tolerance field
2024-10-22 08:29:11 -07:00
pca006132 e718288cbf fix python binding (#987)
* python: fix type casters and warp batch

* python: allow docstring override

* update nanobind version

* python: add docstring_override.txt

* python: fix example

* version limit for nanobind
2024-10-19 01:07:18 +08:00
Emmett Lalish 4d7613bd4f Add RefineToPrecision (#938)
* added RefineToPrecision, but needs work

* fixed 1-d triangulations

* added test of precision

* fixed approximation

* added bindings

* cleanup

* forgot to include
2024-09-27 17:19:29 -07:00
pca006132 31d6da0973 use nanobind builtin stubgen (#949)
* use nanobind builtin stubgen

* fix formatting

* python format

* update nix for newer nanobind

* remove recursive clone flags

* fix extrude.py

* fix install

* add version checks for stubgen

* exclude_from_all

* fix python

* disable nix js variant for CI
2024-09-27 08:02:56 -07:00
Emmett Lalish fbf07bf92a SDF collapse (#894)
* refactor to collapse verts

* fixed missing triangles

* tests pass

* cleanup, docs

* Moved LevelSet from MeshGL to Manifold

* update bindings

* minor fixes

* more python fixes

* update clang-format version

* updated sinesurface test

* revert unneeded change

* fixed WASM

* update Python

* remove opposed triangles

* update format version

* fix format

* remove unreferenced verts

* fix 4-manifolds

* reduce blob resolution

* avoid collapsing thin surfaces

* cleanup, tighten tests

* compromise heuristic

* update test

* slight heuristic tweak and update docs

* loosen genus test
2024-09-01 15:52:47 -07:00
Marcell Leleszi 3258152e2c Add MinGap function (#765)
* Add tests for intersection

* Add POC MinGap implementation and tests

* Add tests where closest point falls on the triangle's face or on one of the edges

* Create TriangleDistance declaration

* Delete intersect tests

* Add stub MinGap definition

* Add triangle distance impl

* Add comments

* Fix tests

* Fix build

* Use collider

* Collider exploration

* Collider impl, cleanup

* Use par transform

* Revert settings.json, add comments

* Add comments

* Move tri_dist to utils

* Delete unnecessary include

* Create lambda for bounding box expansion

* Move duplicate logic to lambda

* Cleanup

* Use floats instead of doubles, use glm::clamp instead of own implementation

* User ternaries

* Remove DistanceTriangleTriangleSquared out params

* Move MinGap impl to Impl

* Use std::array instead of C-style

* Modify MinGap test cases for clarity, add overlapping tri_dist test

* Add c, wasm, python bindings

* Fix formatting

* Clean up comments

* Test whether faceboxes need to be sorted

* Add min_gap example to all_apis.py

* Fix formatting

* Clean up python binding

* Fix edge to edge test case

* Test BVH culling

* Remove sorting of other manifold's boxes

* Use collider_ member, remove sorting

* Move tests to manifold_test.cpp

* Remove whitespace

* Rename some tests for clarity

* Remove redundant test, modify test for edge to edge test for clarity

* Fix comments

* Parallelize narrow phase

* Reduce sphere res in test case to not cause out of memory error

* Add complex test case

* Remove unnecessary cast

* Refactor functor is lambda
2024-04-02 09:32:06 -07:00
Emmett Lalish 3e05284250 Smooth By Normals (#776)
* SmoothByNormals compiles

* added ForVert

* tests pass

* added bindings

* stupid formatting...

* fix typo

* small fix

* aligned weights
2024-03-26 09:30:13 -07:00
Emmett Lalish c9ec16969d CalculateNormals and Smooth (#771)
* started implementation

* update to Vec

* refactor

* snap normals to faces

* added flat face sharpening

* added Smooth member

* Smooth working

* refactor SetNormals

* calculateNormals runs

* CalculateNormals works

* update test

* add bindings

* fix python bindings

* fix format

* Smooth -> SmoothOut

* a few fixes

* weird format bug

* addressing feedback

* update docs
2024-03-19 10:29:02 -07:00
Emmett Lalish dc4afa950b Refine To Length (#741)
* sketched out implementation

* started PartitionQuad

* added edge directions

* compiles

* first test passing

* minor progress

* simplify

* refactor

* fixed interior verts

* getting manifold results

* improved triangulation

* finished algorithm

* fixed fans

* a few fixes

* fixed 3-2-2

* handle reversed triangles

* use Vec

* fixed another bug

* refine working

* replaced old subdivide

* fix allocation error

* fixed sphere

* fix cache

* fixed undefined behavior

* fix rounding error

* updated test

* cleanup

* add lock

* added properties support

* tightened test

* fixed edge colors

* fixed corners

* only duplicate props when necessary

* fix boolean props

* fixed manifoldness error

* fixed some narrow triangles

* fix compile

* added bindings

* fix formatting

* addressing feedback

* revert edge divisions change
2024-03-02 16:15:44 -08:00
Kyle Finn 4395ab622c [python] add MeshGL::Merge() to python API (#739)
* [python] add MeshGL::Merge() to python API

* [python] mesh.merge in all_apis.py
2024-02-13 09:08:50 -08:00
briansturgill f407e43e5b Added BatchBoolean to Python API, both CS & M. (#707) 2024-01-16 15:13:33 +08:00
briansturgill 8ad5f8e427 Extrude and Resolve should be static on Manifold. (#692)
* Extrude and Resolve should be static on Manifold.

* Fixed unit test for extrude/revolve issue.

* More test issues fixed.

* Clean up formatting.

* Placed extrude and revolve on both CrossSection and Manifold.

* Formatting.
2024-01-14 23:06:11 +13:00
briansturgill afc64f248a CrossSection::Compose was accidently left out of Python API. (#700) 2024-01-14 05:41:36 +08:00
Kyle Finn 8c77a6aa05 [python] fix warp callback (#674)
* [python] fix warp callback

I recently broke this making it a no-op due to
the vec reference becoming a by-value copy in python
callback. This fix provides a simple adapter like
we had before allowing python to return modified
values from the callback.

* update torus_knot.py demo to expose both warp modes

* add torus_knot.py to pytest

* use pytest in github CI

* add pytest to flake.nix
2023-12-28 11:54:54 +13:00
Kyle Finn 54fa822408 Python auto doc (#665)
* python autogen docstrings

* use function signature hashes in docstring key

* remove sys.path debug code

* docstrings use param names

* autogen docstrings during cmake

* document gen_docs.py

* more readme, remap mesh_gl references

* readme about verify python docstrings, autogen depend on sources
2023-12-27 09:04:01 +13:00
Kyle Finn 7d564cfbc1 Python more numpy (#656)
* [python] numpy updates and cleanup

Also add CrossSection::Bounds()

* cleanup - const and reference args in py bind

* fix unnamed args

* all_apis.py more coverage

* fixup - more param renaming, docstring fixes

* fixup - run black

* fixup - move const to left side

* fixup extrude.py get_volume

* fix python examples for api update
2023-12-19 08:34:40 +08:00
Kyle Finn bc0bded294 add WarpBatch - array process warp with single callback (#651)
Add WarpBatch - array process warp with single callback
2023-12-17 22:15:28 +13:00
Kyle Finn eba866d266 [python] manifold3d.triangulate and CrossSection.to_polygons_numpy (#650) 2023-12-14 21:51:48 +13:00
Emmett Lalish cc4966f062 added Colab Python example (#648)
added colab example
2023-12-14 07:33:50 +13:00
Chun Kit LAM 4551288f95 Use black formatter for python format checking (#618)
* added black formatter to ci

* format gyroid_module.py
2023-11-16 20:44:07 +08:00
Emmett Lalishandpca006132 2e29784449 Update python bindings (#615)
* updated python bindings

* added scallop example

* fix python binding and example

* apply black formatting

---------

Co-authored-by: pca006132 <john.lck40@gmail.com>
2023-11-15 22:51:51 -08:00
Johnathon Selstad 2a2cb6f88e [FEAT] Add LevelSet Function to Python Bindings (#616)
* Commit LevelSet Python Binding

* Address PR Comments

* Standardize Indentation
2023-11-15 22:24:45 -08:00
Johnathon Selstad b9f7228064 [FIX] Packaged Split() output to Tuple (#593)
* Fix the Split Function

* Fix Formatting

* Also update split_by_plane

* Add Cube Splitting Example
2023-11-07 12:18:27 +08:00
Chun Kit LAM 8651bf8bd5 nanobind (#537)
* python stuff

* do not choose musllinux_1_2

* skip musl build

musllinux_1_1 is too old

* try musllinux_1_2

* pep-0632

* fix

* update

* fix CI

* skip emulated tests on mac

* use build frontend

* use scikit-build-core

* re-enable action

* minor changes

speed up compilation a bit

* use nanobind

* don't use SABIModule for older python versions

* fix build error

* fix find and replace error

* Revert "re-enable action"

This reverts commit b3ede2a707743def16ded29bfb8e2b9a1c37f596.
2023-08-28 13:41:34 +08:00
Emmett Lalishandpca006132 ffdd97d4d3 adding python set_properties (#504)
* adding test of properties

* python set_properties

* fixed sponge example

---------

Co-authored-by: pca006132 <john.lck40@gmail.com>
2023-07-29 22:10:28 -07:00
Emmett Lalishandpca006132 93e06a2de8 Update python mesh (#492)
* updated python mesh

* updated python meshgl

* clean up array related stuff

* fix hsplit

* fix according to comments

* make to_mesh accept MeshGL

* fixes

---------

Co-authored-by: pca006132 <john.lck40@gmail.com>
2023-07-24 12:08:00 +08:00
Emmett Lalish 8b7bf4231b updated python doc strings (#488)
* updated doc strings

* pymanifold -> manifold3d
2023-07-13 11:34:31 -07:00
Johnny Bigert f6431112a8 Update Python bindings (#445)
* Added more Python bindings (CrossSection) and some clarifying Python examples on how to create polygons etc
* Returned extrude from Python example and renamed accordingly.
* Removed PolygonWrapper class from Python bindings
2023-06-08 10:52:10 -07:00
pca006132 0704f62eaa added maze benchmark (#333) 2023-02-24 01:00:13 +08:00
pca006132 a701d2be8e weird bug for python binding (#307)
* weird bug for python binding

* formatting
2023-01-06 08:06:44 -08:00
pca006132andEmmett Lalish 8538cf5ee3 use compose for disjoint union (#217)
* use compose for disjoint union

Last mystery in #114. It turns out that the problem is due to
misunderstanding of the bounding box API: Box::Transform is *not* a safe
over-approximation of the bounding box of the manifold after the
transform. In fact it might be smaller than that if the transform is not
axis aligned. The simple fix is to apply the transform first and then
compute the bounding box, this will also make sure that the bounding box
is tight.

* fix batch union

Co-authored-by: Emmett Lalish <elalish@gmail.com>
2022-09-24 23:35:05 -07:00
Emmett Lalish f6839a36e6 updated python exporter from meshio to trimesh (#204) 2022-09-18 16:34:20 -07:00
Emmett Lalish 73a53e0ff8 Removing export from python binding (#190)
* try python meshio

* removed meshIO dependency

* fixed to_mesh

* fix nix

* more nix fix
2022-09-05 09:29:28 -07:00
Emmett Lalish 4add644d76 merging master 2022-07-20 14:54:45 -07:00
Emmett Lalish d404b26d7a examples adjustments 2022-07-19 21:28:38 -07:00