From 1fb8c86aa074af7fa5baf2c4efd56a80ec8aa746 Mon Sep 17 00:00:00 2001 From: Zachary Ferguson Date: Tue, 11 Mar 2025 21:37:56 -0400 Subject: [PATCH 1/2] Add binding for is_vertex_manifold --- src/is_vertex_manifold.cpp | 39 ++++++++++++++++++++++++++++++++++++++ tutorial/igl_docs.md | 18 +++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/is_vertex_manifold.cpp diff --git a/src/is_vertex_manifold.cpp b/src/is_vertex_manifold.cpp new file mode 100644 index 00000000..fe110257 --- /dev/null +++ b/src/is_vertex_manifold.cpp @@ -0,0 +1,39 @@ +#include "default_types.h" +#include +#include +#include +#include +#include + +namespace nb = nanobind; +using namespace nb::literals; + +namespace pyigl +{ + // Wrapper for is_vertex_manifold with overload handling + auto is_vertex_manifold( + const nb::DRef &F) + { + Eigen::Matrix B; + igl::is_vertex_manifold(F, B); + return B; + } +} + +// Bind the wrapper to the Python module +void bind_is_vertex_manifold(nb::module_ &m) +{ + m.def( + "is_vertex_manifold", + &pyigl::is_vertex_manifold, + "F"_a, +R"(Check if a mesh is vertex-manifold. + +This only checks whether the faces incident on each vertex form exactly one +connected component. Vertices incident on non-manifold edges are not consider +non-manifold by this function (see is_edge_manifold). Unreferenced verties are +considered non-manifold (zero components). + +@param[in] F #F by 3 list of triangle indices +@return B #V list indicate whether each vertex is locally manifold (the mesh is vertex manifold if all(B) == True)"); +} diff --git a/tutorial/igl_docs.md b/tutorial/igl_docs.md index 78168209..221e2b54 100644 --- a/tutorial/igl_docs.md +++ b/tutorial/igl_docs.md @@ -1505,7 +1505,23 @@ IS_DELAUNAY Determine if each edge in the mesh (V,F) is Delaunay. ### is_edge_manifold **`is_edge_manifold(f: array) -> bool`** -See is_edge_manifold for the documentation. +Check if the mesh is edge-manifold (every edge is incident one one face (boundary) or two oppositely oriented faces). + +| | | +|-|-| +|Parameters| F: \#F by 3 list of triangle indices | +|Returns| True iff all edges are manifold | + +### is_vertex_manifold +**`is_vertex_manifold(f: array) -> bool`** + +Check if a mesh is vertex-manifold. This only checks whether the faces incident on each vertex form exactly one connected component. Vertices incident on non-manifold edges are not consider non-manifold by this function (see is_edge_manifold). Unreferenced verties are considered non-manifold (zero components). + +| | | +|-|-| +|Parameters| F \#F by 3 list of triangle indices | +|Returns| B \#V list indicate whether each vertex is locally manifold.
The mesh is vertex manifold if `all(B) == True`. | + ### is_intrinsic_delaunay **`is_intrinsic_delaunay(l: array, f: array)`** From e4bcbb85e754e8d8d2bb2c265e0c7c135e2650e3 Mon Sep 17 00:00:00 2001 From: Zachary Ferguson Date: Tue, 11 Mar 2025 21:39:04 -0400 Subject: [PATCH 2/2] Remove unused header --- src/is_vertex_manifold.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/is_vertex_manifold.cpp b/src/is_vertex_manifold.cpp index fe110257..a80873b8 100644 --- a/src/is_vertex_manifold.cpp +++ b/src/is_vertex_manifold.cpp @@ -3,7 +3,6 @@ #include #include #include -#include namespace nb = nanobind; using namespace nb::literals;