Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
os: [ubuntu-latest, macos-latest, macos-14]
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
env:
MACOSX_DEPLOYMENT_TARGET: '15.0'
MACOSX_DEPLOYMENT_TARGET: '15.0'
CGAL_VERSION: '6.0.1'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -25,8 +26,17 @@ jobs:
run: |
python -m pip install --upgrade pip
- if: matrix.os == 'ubuntu-latest'
# ubuntu-latest is still 24.04, whose libcgal-dev is 5.6. Passing an
# edge_is_constrained_map to the mesh-mesh PMP::clip does not compile
# there: 5.6's put() for Boolean_property_map takes a non-const
# reference and the corefinement internals pass it as const. Fixed in
# CGAL 6, so fetch the headers (CGAL is header-only) rather than wait
# for the runner image to catch up.
run: |
sudo apt-get install -y libgl1-mesa-dev libeigen3-dev libcgal-dev
sudo apt-get install -y libgl1-mesa-dev libeigen3-dev libboost-dev libgmp-dev libmpfr-dev
wget -q https://github.com/CGAL/cgal/releases/download/v${CGAL_VERSION}/CGAL-${CGAL_VERSION}.tar.xz
tar -xf CGAL-${CGAL_VERSION}.tar.xz
echo "CMAKE_ARGS=-DCGAL_DIR=$PWD/CGAL-${CGAL_VERSION}/lib/cmake/CGAL" >> $GITHUB_ENV
- if: ${{ startsWith(matrix.os, 'macos') }}
run: |
brew install cgal
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(CGAL REQUIRED)
# 6.0 minimum: the mesh-mesh PMP::clip with an edge_is_constrained_map does not
# compile against 5.6 (its put() for Boolean_property_map takes a non-const ref).
# Stating the floor turns a 200-line template error into one clear message.
find_package(CGAL 6.0 REQUIRED)
find_package(pybind11 REQUIRED)

include_directories(${CMAKE_SOURCE_DIR}/src)
Expand Down
14 changes: 13 additions & 1 deletion loop_cgal/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ PYBIND11_MODULE(_loop_cgal, m)
"Clip the mesh with the halfspace ax+by+cz+d <= 0. "
"Uses PMP::clip(mesh, Plane_3) directly — no corefinement, no skirt construction. "
"Returns the number of faces removed (0 = no-op).")
.def("corefine", &TriMesh::corefine, py::arg("other"),
py::arg("use_exact_kernel") = true,
"Corefine this mesh with another, inserting the shared intersection "
"polyline into BOTH meshes in place. After the call the two meshes "
"carry coincident vertices/edges along the intersection curve, so "
"patches taken from each side stitch together watertight. "
"Returns the number of vertices added to this mesh. "
"Only the exact kernel is supported; use_exact_kernel=False raises "
"ValueError (inexact-kernel corefinement crashes).")
.def("cut_with_surface", &TriMesh::cutWithSurface, py::arg("surface"),
py::arg("preserve_intersection") = false,
py::arg("preserve_intersection_clipper") = false,
Expand All @@ -51,7 +60,10 @@ PYBIND11_MODULE(_loop_cgal, m)
"Vertex index pairs defining edges to be fixed in mesh when remeshing.")
.def("cut_with_implicit_function", &TriMesh::cut_with_implicit_function,
py::arg("property"), py::arg("value"),py::arg("cutmode") = ImplicitCutMode::KEEP_POSITIVE_SIDE,
"Cut the mesh with an implicit function defined by vertex properties.")
py::arg("snap_tol") = 1e-4,
"Cut the mesh with an implicit function defined by vertex properties. "
"snap_tol reuses an existing vertex when a crossing lands within that "
"fraction of an edge from it, preventing sliver triangles (0 = disable).")
.def("_cgal_area", &TriMesh::area, "Surface area computed directly from CGAL mesh.")
.def("_cgal_n_faces", &TriMesh::n_faces, "Number of faces in the CGAL mesh.")
.def("_cgal_n_vertices", &TriMesh::n_vertices, "Number of vertices in the CGAL mesh.")
Expand Down
Loading
Loading