Skip to content

Conversation

@bmahlbrand
Copy link
Contributor

@bmahlbrand bmahlbrand commented Oct 24, 2025

Hello! still need to add tests, but bindings are building for igl::edges_to_path (looks like it was removed at some point)

There's some funky template magic I got from chatgpt to get it to build since I don't have much experience with debugging weird eigen type problems

enclosed logs from CI (a previous commit that failed to build which led me to the current state)

  FAILED: CMakeFiles/pyigl_core.dir/src/edges_to_path.cpp.o
  /usr/bin/g++ -Dpyigl_core_EXPORTS -I/home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/include -I/home/runner/work/libigl-python-bindings/libigl-python-bindings/include -I/opt/hostedtoolcache/Python/3.10.19/arm64/include/python3.10 -I/home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/nanobind-src/include -I/home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/libigl-src/include -isystem /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src -fdiagnostics-color=always -O3 -DNDEBUG -fPIC -fvisibility=hidden   -fdiagnostics-color=always -fno-stack-protector -Os -ffunction-sections -fdata-sections -MD -MT CMakeFiles/pyigl_core.dir/src/edges_to_path.cpp.o -MF CMakeFiles/pyigl_core.dir/src/edges_to_path.cpp.o.d -o CMakeFiles/pyigl_core.dir/src/edges_to_path.cpp.o -c /home/runner/work/libigl-python-bindings/libigl-python-bindings/src/edges_to_path.cpp
  In file included from /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/libigl-src/include/igl/edges_to_path.h:32,
                   from /home/runner/work/libigl-python-bindings/libigl-python-bindings/src/edges_to_path.cpp:2:
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/libigl-src/include/igl/edges_to_path.cpp: In instantiation of ‘void igl::edges_to_path(const Eigen::MatrixBase<Derived>&, Eigen::PlainObjectBase<DerivedI>&, Eigen::PlainObjectBase<DerivedJ>&, Eigen::PlainObjectBase<DerivedK>&) [with DerivedE = Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >; DerivedI = Eigen::Matrix<long int, -1, 1, 0, -1, 1>; DerivedJ = Eigen::Matrix<long int, -1, 1, 0, -1, 1>; DerivedK = Eigen::Matrix<long int, -1, 1, 0, -1, 1>]’:
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/src/edges_to_path.cpp:16:27:   required from here
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/libigl-src/include/igl/edges_to_path.cpp:62:36: error: no matching function for call to ‘Eigen::Map<Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >, 0, Eigen::Stride<0, 0> >::Map(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1> >::Scalar*, Eigen::EigenBase<Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > >::Index, Eigen::EigenBase<Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > >::Index)’
     62 |   PlainMatrix<DerivedE> E = Eigen::Map<DerivedE>(vE.data(),OE.rows(),OE.cols()).eval();
        |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/Core:19,
                   from /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/Dense:1,
                   from /home/runner/work/libigl-python-bindings/libigl-python-bindings/include/default_types.h:1,
                   from /home/runner/work/libigl-python-bindings/libigl-python-bindings/src/edges_to_path.cpp:1:
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/Map.h:162:5: note: candidate: ‘Eigen::Map<MatrixType, MapOptions, StrideType>::Map(const Eigen::Map<MatrixType, MapOptions, StrideType>&) [with PlainObjectType = Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>]’
    162 |     EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/Map.h:162:5: note:   candidate expects 1 argument, 3 provided
  In file included from /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/Core:307:
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/Map.h:156:12: note: candidate: ‘Eigen::Map<MatrixType, MapOptions, StrideType>::Map(PointerArgType, Eigen::Index, Eigen::Index, const StrideType&) [with PlainObjectType = Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; PointerArgType = const long int*; Eigen::Index = long int]’
    156 |     inline Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType& stride = StrideType())
        |            ^~~
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/Map.h:156:31: note:   no known conversion for argument 1 from ‘Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1> >::Scalar*’ {aka ‘int*’} to ‘Eigen::Map<Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >, 0, Eigen::Stride<0, 0> >::PointerArgType’ {aka ‘const long int*’}
    156 |     inline Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType& stride = StrideType())
        |                ~~~~~~~~~~~~~~~^~~~~~~
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/Map.h:142:12: note: candidate: ‘Eigen::Map<MatrixType, MapOptions, StrideType>::Map(PointerArgType, Eigen::Index, const StrideType&) [with PlainObjectType = Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; PointerArgType = const long int*; Eigen::Index = long int]’
    142 |     inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType())
        |            ^~~
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/Map.h:142:31: note:   no known conversion for argument 1 from ‘Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1> >::Scalar*’ {aka ‘int*’} to ‘Eigen::Map<Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >, 0, Eigen::Stride<0, 0> >::PointerArgType’ {aka ‘const long int*’}
    142 |     inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType())
        |                ~~~~~~~~~~~~~~~^~~~~~~
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/Map.h:129:21: note: candidate: ‘Eigen::Map<MatrixType, MapOptions, StrideType>::Map(PointerArgType, const StrideType&) [with PlainObjectType = Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >; int MapOptions = 0; StrideType = Eigen::Stride<0, 0>; PointerArgType = const long int*]’
    129 |     explicit inline Map(PointerArgType dataPtr, const StrideType& stride = StrideType())
        |                     ^~~
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/Map.h:129:21: note:   candidate expects 2 arguments, 3 provided
  In file included from /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/Core:164:
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/DenseCoeffsBase.h: In instantiation of ‘Eigen::DenseCoeffsBase<Derived, 0>::CoeffReturnType Eigen::DenseCoeffsBase<Derived, 0>::coeff(Eigen::Index) const [with Derived = Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >; CoeffReturnType = long int; Eigen::Index = long int]’:
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/DenseCoeffsBase.h:182:19:   required from ‘Eigen::DenseCoeffsBase<Derived, 0>::CoeffReturnType Eigen::DenseCoeffsBase<Derived, 0>::operator()(Eigen::Index) const [with Derived = Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >; CoeffReturnType = long int; Eigen::Index = long int]’
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/libigl-src/include/igl/edges_to_path.cpp:24:14:   required from ‘void igl::edges_to_path(const Eigen::MatrixBase<Derived>&, Eigen::PlainObjectBase<DerivedI>&, Eigen::PlainObjectBase<DerivedJ>&, Eigen::PlainObjectBase<DerivedK>&) [with DerivedE = Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> >; DerivedI = Eigen::Matrix<long int, -1, 1, 0, -1, 1>; DerivedJ = Eigen::Matrix<long int, -1, 1, 0, -1, 1>; DerivedK = Eigen::Matrix<long int, -1, 1, 0, -1, 1>]’
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/src/edges_to_path.cpp:16:27:   required from here
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/DenseCoeffsBase.h:142:7: error: static assertion failed: THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS
    142 |       EIGEN_STATIC_ASSERT(internal::evaluator<Derived>::Flags & LinearAccessBit,
        |       ^~~~~~~~~~~~~~~~~~~
  /home/runner/work/libigl-python-bindings/libigl-python-bindings/build/cp310-cp310-linux_aarch64/_deps/eigen-src/Eigen/src/Core/DenseCoeffsBase.h:142:7: note: ‘(((unsigned int)((int)Eigen::internal::evaluator<Eigen::Ref<const Eigen::Matrix<long int, -1, -1, 1>, 0, Eigen::Stride<-1, -1> > >::Flags)) & ((unsigned int)Eigen::LinearAccessBit))’ evaluates to false
  [138/269] Building CXX object CMakeFiles/pyigl_core.dir/src/exact_geodesic.cpp.o
  [139/269] Building CXX object CMakeFiles/pyigl_core.dir/src/face_areas.cpp.o
  [140/269] Building CXX object CMakeFiles/pyigl_core.dir/src/facet_adjacency_matrix.cpp.o
  [141/269] Building CXX object CMakeFiles/pyigl_core.dir/src/facet_components.cpp.o
  [142/269] Building CXX object CMakeFiles/pyigl_core.dir/src/dual_contouring.cpp.o
  ninja: build stopped: subcommand failed.

add edges_to_path function and its binding
Updated edges_to_path function to ensure input is 32-bit int for compatibility with libigl's implementation.
Added a new test for edge_to_paths function.
@bmahlbrand bmahlbrand marked this pull request as ready for review October 24, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant