From babf491b69087fd4800a79e450d20d269e00a2c2 Mon Sep 17 00:00:00 2001 From: Alec Jacobson Date: Fri, 1 Jan 2021 18:14:00 -0500 Subject: [PATCH] pure k-gon to corners --- include/igl/polygon_corners.cpp | 29 +++++++++++++++++++++++++++++ include/igl/polygon_corners.h | 14 ++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/include/igl/polygon_corners.cpp b/include/igl/polygon_corners.cpp index e424a9567..9f6af8cc1 100644 --- a/include/igl/polygon_corners.cpp +++ b/include/igl/polygon_corners.cpp @@ -34,8 +34,37 @@ IGL_INLINE void igl::polygon_corners( I = Eigen::Map(vI.data(),vI.size()); } +template < + typename DerivedQ, + typename DerivedI, + typename DerivedC> +IGL_INLINE void igl::polygon_corners( + const Eigen::MatrixBase & Q, + Eigen::PlainObjectBase & I, + Eigen::PlainObjectBase & C) +{ + I.resize(Q.size()); + C.resize(Q.rows()+1); + int c = 0; + C(0) = 0; + for(int p = 0;p, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh template void igl::polygon_corners, Eigen::Matrix >(std::vector >, std::allocator > > > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif diff --git a/include/igl/polygon_corners.h b/include/igl/polygon_corners.h index 8db4dd019..afdcdd620 100644 --- a/include/igl/polygon_corners.h +++ b/include/igl/polygon_corners.h @@ -32,6 +32,20 @@ namespace igl const std::vector > & P, Eigen::PlainObjectBase & I, Eigen::PlainObjectBase & C); + // Convert a pure k-gon list of polygon mesh indices to list of polygon corners + // and sizes + // + // Inputs: + // Q #Q by k list of k-gon indices (Q(i,j) = -1 means that face i is a + // j-gon) + template < + typename DerivedQ, + typename DerivedI, + typename DerivedC> + IGL_INLINE void polygon_corners( + const Eigen::MatrixBase & Q, + Eigen::PlainObjectBase & I, + Eigen::PlainObjectBase & C); } #ifndef IGL_STATIC_LIBRARY