Files
Zach LoafmanandClaude Opus 4.8 db042ab153 Cut over CrossSection from Clipper2 to boolean2 (#1751)
* Wire CrossSection to the boolean2 backend

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

* Simplify CrossSection via vertex decimation, not merge-tolerance snap

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

* Address wiring review: Hull/finite guards, inline mutex, signpost, asserts

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

* Migrate CrossSection wiring to ApplyFillRule; Simplify decimates only

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

* Defer transform tolerance scaling to GetPaths; fix Simplify comment

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

* Tidy wiring comments to house style; use la::isfinite for guards

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

* Cut over CrossSection from Clipper2 to boolean2

Replace the Clipper2-backed CrossSection implementation with the in-tree boolean2 one and drop the Clipper2 dependency, the MANIFOLD_CROSS_SECTION_BACKEND selector, and its CI and packaging plumbing. The public CrossSection API is unchanged: the FillRule argument is kept but only Positive construction is supported. Samples.Sponge4's degenerate-triangle bound is raised, since boolean2's Simplify leaves more near-collinear vertices (more benign zero-area tris; topology unchanged).

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

* Delegate single-contour CrossSection ctor to the Polygons one

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

* Always build CrossSection; drop the MANIFOLD_CROSS_SECTION option

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

* Flatten manifold::boolean2 into manifold; unify JoinType

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

* Make SimplifyRing O(n log n) via min-heap with lazy invalidation

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

* Drop stale MANIFOLD_CROSS_SECTION flag from the PR perf guard script

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

* Scrub Clipper2 and the removed option from the new sanitizer CI script

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 08:06:37 +12:00

144 lines
4.2 KiB
Nix

{
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
outputs =
{ self
, nixpkgs
, flake-utils
}:
flake-utils.lib.eachDefaultSystem
(system:
let
manifold-version = "3.5.1";
pkgs = import nixpkgs {
inherit system;
};
manifold =
{ parallel ? true }: pkgs.stdenv.mkDerivation {
pname = "manifold-${if parallel then "tbb" else "none"}";
version = manifold-version;
src = self;
nativeBuildInputs = (with pkgs; [
cmake
ninja
(python3.withPackages
(ps: with ps; [ nanobind trimesh pytest ]))
gtest
]) ++ (if parallel then [ pkgs.onetbb ] else [ ]);
buildInputs = [ ];
cmakeFlags = [
"-DMANIFOLD_STRICT=ON"
"-DMANIFOLD_CBIND=ON"
"-DBUILD_SHARED_LIBS=ON"
"-DMANIFOLD_PAR=${if parallel then "ON" else "OFF"}"
];
doCheck = true;
checkPhase = ''
cd test
./manifold_test
cd ../
'';
};
manifold-emscripten = { doCheck ? true, parallel ? false }: pkgs.buildEmscriptenPackage {
name = "manifold-js";
version = manifold-version;
src = self;
nativeBuildInputs = (with pkgs; [ cmake python3 ]);
buildInputs = [ pkgs.nodejs ];
configurePhase = ''
mkdir -p .emscriptencache
export EM_CACHE=$(pwd)/.emscriptencache
mkdir build
cd build
emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel \
-DMANIFOLD_STRICT=ON \
-DMANIFOLD_PAR=${if parallel then "ON" else "OFF"} \
-DMANIFOLD_USE_BUILTIN_TBB=${if parallel then "ON" else "OFF"} \
-DFETCHCONTENT_SOURCE_DIR_GOOGLETEST=${pkgs.gtest.src} \
-DFETCHCONTENT_SOURCE_DIR_TBB=${pkgs.onetbb.src} ..
'';
buildPhase = ''
emmake make -j''${NIX_BUILD_CORES}
'';
checkPhase =
if doCheck then ''
cd test
node manifold_test.js
cd ../
'' else "";
installPhase = ''
mkdir -p $out
cp bindings/wasm/manifold.* $out/
'';
};
in
{
packages = {
manifold-tbb = manifold { };
manifold-none = manifold { parallel = false; };
manifold-js = manifold-emscripten { };
manifold-js-tbb = manifold-emscripten {
parallel = true;
doCheck =
false;
};
# but how should we make it work with other python versions?
manifold3d = with pkgs.python3Packages; buildPythonPackage {
pname = "manifold3d";
version = manifold-version;
src = self;
propagatedBuildInputs = [ numpy ];
buildInputs = with pkgs; [ onetbb ];
nativeBuildInputs = with pkgs; [
cmake
ninja
setuptools
scikit-build-core
pyproject-metadata
pathspec
];
checkInputs = [ nanobind trimesh pytest ];
format = "pyproject";
dontUseCmakeConfigure = true;
doCheck = true;
checkPhase = ''
python3 bindings/python/examples/run_all.py
python3 -m pytest
'';
};
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
(python3.withPackages (ps: with ps; [
# test dependencies
trimesh
numpy
pytest
# formatting tools
black
# misc
matplotlib
]))
gersemi
ninja
cmake
onetbb
gtest
assimp
pkg-config
# useful tools
clang_18
llvmPackages_18.clang-tools
llvmPackages_18.bintools
tracy
f3d
];
};
}
);
}