From 1deb4717279fb488438af2b960b9be28441a2585 Mon Sep 17 00:00:00 2001 From: Alec Jacobson Date: Fri, 28 Dec 2018 14:16:20 -0600 Subject: [PATCH] extra boundary_facets outputs; better sort prototypes; templates; cleanup --- include/igl/WindingNumberTree.h | 2 - include/igl/accumarray.cpp | 22 ++++- include/igl/accumarray.h | 13 +++ include/igl/boundary_facets.cpp | 129 +++++++++++++++++++++----- include/igl/boundary_facets.h | 16 +--- include/igl/face_occurrences.cpp | 15 +++ include/igl/face_occurrences.h | 7 +- include/igl/matlab_format.cpp | 4 + include/igl/reorder.cpp | 2 + include/igl/sort.cpp | 24 +++++ include/igl/sort.h | 6 ++ include/igl/sortrows.cpp | 17 ++++ include/igl/sortrows.h | 5 + include/igl/unique_rows.cpp | 6 ++ include/igl/vector_area_matrix.cpp | 4 +- tests/include/igl/accumarray.cpp | 11 +++ tests/include/igl/boundary_facets.cpp | 34 ++++++- 17 files changed, 270 insertions(+), 47 deletions(-) diff --git a/include/igl/WindingNumberTree.h b/include/igl/WindingNumberTree.h index 317ad9442..91d084e6c 100644 --- a/include/igl/WindingNumberTree.h +++ b/include/igl/WindingNumberTree.h @@ -164,7 +164,6 @@ inline igl::WindingNumberTree::WindingNumberTree(): V(dummyV), SV(), F(), - //boundary(igl::boundary_facets(F)) cap(), radius(std::numeric_limits::infinity()), center(0,0,0) @@ -180,7 +179,6 @@ inline igl::WindingNumberTree::WindingNumberTree( V(dummyV), SV(), F(), - //boundary(igl::boundary_facets(F)) cap(), radius(std::numeric_limits::infinity()), center(0,0,0) diff --git a/include/igl/accumarray.cpp b/include/igl/accumarray.cpp index 2d36bbc78..28d42cc71 100644 --- a/include/igl/accumarray.cpp +++ b/include/igl/accumarray.cpp @@ -19,6 +19,7 @@ void igl::accumarray( Eigen::PlainObjectBase & A) { assert(V.size() == S.size() && "S and V should be same size"); + if(S.size() == 0) { A.resize(0,1); return; } A.setZero(S.maxCoeff()+1,1); for(int s = 0;s +void igl::accumarray( + const Eigen::MatrixBase & S, + const typename DerivedA::Scalar V, + Eigen::PlainObjectBase & A) +{ + if(S.size() == 0) { A.resize(0,1); return; } + A.setZero(S.maxCoeff()+1,1); + for(int s = 0;s, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::Matrix::Scalar, Eigen::PlainObjectBase >&); template void igl::accumarray, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); #endif diff --git a/include/igl/accumarray.h b/include/igl/accumarray.h index e5c9bcad0..1afbddb76 100644 --- a/include/igl/accumarray.h +++ b/include/igl/accumarray.h @@ -28,6 +28,19 @@ namespace igl const Eigen::MatrixBase & S, const Eigen::MatrixBase & V, Eigen::PlainObjectBase & A); + // Inputs: + // S #S list of subscripts + // V single value used for all + // Outputs: + // A max(subs)+1 list of accumulated values + template < + typename DerivedS, + typename DerivedA + > + void accumarray( + const Eigen::MatrixBase & S, + const typename DerivedA::Scalar V, + Eigen::PlainObjectBase & A); } #ifndef IGL_STATIC_LIBRARY diff --git a/include/igl/boundary_facets.cpp b/include/igl/boundary_facets.cpp index 74e1215ad..cd7c6ac52 100644 --- a/include/igl/boundary_facets.cpp +++ b/include/igl/boundary_facets.cpp @@ -7,31 +7,120 @@ // obtain one at http://mozilla.org/MPL/2.0/. #include "boundary_facets.h" #include "face_occurrences.h" - -// IGL includes +#include "list_to_matrix.h" +#include "matrix_to_list.h" +#include "matlab_format.h" #include "sort.h" +#include "unique_rows.h" +#include "accumarray.h" +#include "slice_mask.h" + +#include -// STL includes #include #include -#include "list_to_matrix.h" -#include "matrix_to_list.h" +template < + typename DerivedT, + typename DerivedF, + typename DerivedJ, + typename DerivedK> +IGL_INLINE void igl::boundary_facets( + const Eigen::MatrixBase& T, + Eigen::PlainObjectBase& F, + Eigen::PlainObjectBase& J, + Eigen::PlainObjectBase& K) +{ + const int simplex_size = T.cols(); + // Handle boring base case + if(T.rows() == 0) + { + F.resize(0,simplex_size-1); + J.resize(0,1); + K.resize(0,1); + return; + } + // Get a list of all facets + DerivedF allF(T.rows()*simplex_size,simplex_size-1); + // Gather faces (e.g., loop over tets) + for(int i = 0; i< (int)T.rows();i++) + { + switch(simplex_size) + { + case 4: + // get face in correct order + allF(i*simplex_size+0,0) = T(i,1); + allF(i*simplex_size+0,1) = T(i,3); + allF(i*simplex_size+0,2) = T(i,2); + // get face in correct order + allF(i*simplex_size+1,0) = T(i,0); + allF(i*simplex_size+1,1) = T(i,2); + allF(i*simplex_size+1,2) = T(i,3); + // get face in correct order + allF(i*simplex_size+2,0) = T(i,0); + allF(i*simplex_size+2,1) = T(i,3); + allF(i*simplex_size+2,2) = T(i,1); + // get face in correct order + allF(i*simplex_size+3,0) = T(i,0); + allF(i*simplex_size+3,1) = T(i,1); + allF(i*simplex_size+3,2) = T(i,2); + break; + case 3: + allF(i*simplex_size+0,0) = T(i,1); + allF(i*simplex_size+0,1) = T(i,2); + allF(i*simplex_size+1,0) = T(i,2); + allF(i*simplex_size+1,1) = T(i,0); + allF(i*simplex_size+2,0) = T(i,0); + allF(i*simplex_size+2,1) = T(i,1); + break; + } + } + DerivedF sortedF; + igl::sort(allF,2,true,sortedF); + Eigen::VectorXi m,n; + { + DerivedF _1; + igl::unique_rows(sortedF,_1,m,n); + } + Eigen::VectorXi C; + igl::accumarray(n,1,C); + const int ones = (C.array()==1).count(); + // Resize output to fit number of non-twos + F.resize(ones, allF.cols()); + J.resize(F.rows(),1); + K.resize(F.rows(),1); + int k = 0; + for(int c = 0;c< (int)C.size();c++) + { + if(C(c) == 1) + { + const int i = m(c); + assert(k<(int)F.rows()); + F.row(k) = allF.row(i); + J(k) = i/simplex_size; + K(k) = i%simplex_size; + k++; + } + } + assert(k==(int)F.rows()); +} template IGL_INLINE void igl::boundary_facets( const Eigen::MatrixBase& T, Eigen::PlainObjectBase& F) { - assert(T.cols() == 0 || T.cols() == 4 || T.cols() == 3); - using namespace std; - using namespace Eigen; - // Cop out: use vector of vectors version - vector > vT; - matrix_to_list(T,vT); - vector > vF; - boundary_facets(vT,vF); - list_to_matrix(vF,F); + Eigen::VectorXi J,K; + return boundary_facets(T,F,J,K); +} + +template +Ret igl::boundary_facets( + const Eigen::MatrixBase& T) +{ + Ret F; + igl::boundary_facets(T,F); + return F; } template @@ -118,23 +207,15 @@ IGL_INLINE void igl::boundary_facets( } -template -Ret igl::boundary_facets( - const Eigen::MatrixBase& T) -{ - Ret F; - igl::boundary_facets(T,F); - return F; -} - #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh +template void igl::boundary_facets, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh template void igl::boundary_facets, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::boundary_facets, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); -template void igl::boundary_facets, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::boundary_facets(std::vector >, std::allocator > > > const&, std::vector >, std::allocator > > >&); //template Eigen::MatrixBase > igl::boundary_facets(Eigen::PlainObjectBase > const&); template Eigen::Matrix igl::boundary_facets, Eigen::Matrix >(Eigen::MatrixBase > const&); diff --git a/include/igl/boundary_facets.h b/include/igl/boundary_facets.h index 18c506f1c..9258db69b 100644 --- a/include/igl/boundary_facets.h +++ b/include/igl/boundary_facets.h @@ -37,18 +37,6 @@ namespace igl Eigen::PlainObjectBase& J, Eigen::PlainObjectBase& K); template - IGL_INLINE void boundary_facets( - const Eigen::MatrixBase& T, - Eigen::PlainObjectBase& F); - template - IGL_INLINE void boundary_facets( - const std::vector > & T, - std::vector > & F); - - // Templates: - // DerivedT integer-value: i.e. from MatrixXi - // DerivedF integer-value: i.e. from MatrixXi - template IGL_INLINE void boundary_facets( const Eigen::MatrixBase& T, Eigen::PlainObjectBase& F); @@ -56,6 +44,10 @@ namespace igl template Ret boundary_facets( const Eigen::MatrixBase& T); + template + IGL_INLINE void boundary_facets( + const std::vector > & T, + std::vector > & F); } #ifndef IGL_STATIC_LIBRARY diff --git a/include/igl/face_occurrences.cpp b/include/igl/face_occurrences.cpp index 4ef43f822..bdaaa8ffd 100644 --- a/include/igl/face_occurrences.cpp +++ b/include/igl/face_occurrences.cpp @@ -6,6 +6,8 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "face_occurrences.h" +#include "list_to_matrix.h" +#include "matrix_to_list.h" #include #include "sort.h" @@ -50,6 +52,19 @@ IGL_INLINE void igl::face_occurrences( } } +template +IGL_INLINE void igl::face_occurrences( + const Eigen::MatrixBase & F, + Eigen::PlainObjectBase & C) +{ + // Should really just rewrite using Eigen+libigl ... + std::vector > vF; + matrix_to_list(F,vF); + std::vector > vC; + igl::face_occurrences(vF,vC); + list_to_matrix(vC,C); +} + #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh diff --git a/include/igl/face_occurrences.h b/include/igl/face_occurrences.h index de47b504c..48f4b11e2 100644 --- a/include/igl/face_occurrences.h +++ b/include/igl/face_occurrences.h @@ -8,11 +8,12 @@ #ifndef IGL_FACE_OCCURRENCES #define IGL_FACE_OCCURRENCES #include "igl_inline.h" +#include #include namespace igl { - // Count the occruances of each face (row) in a list of face indices + // Count the occurances of each face (row) in a list of face indices // (irrespecitive of order) // Inputs: // F #F by simplex-size @@ -23,6 +24,10 @@ namespace igl IGL_INLINE void face_occurrences( const std::vector > & F, std::vector & C); + template + IGL_INLINE void face_occurrences( + const Eigen::MatrixBase & F, + Eigen::PlainObjectBase & C); } #ifndef IGL_STATIC_LIBRARY diff --git a/include/igl/matlab_format.cpp b/include/igl/matlab_format.cpp index 1559bb497..1434c5030 100644 --- a/include/igl/matlab_format.cpp +++ b/include/igl/matlab_format.cpp @@ -113,6 +113,10 @@ IGL_INLINE const std::string igl::matlab_format( #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation +// generated by autoexplicit.sh +template Eigen::WithFormat > const igl::matlab_format >(Eigen::DenseBase > const&, std::basic_string, std::allocator >); +// generated by autoexplicit.sh +template Eigen::WithFormat > const igl::matlab_format >(Eigen::DenseBase > const&, std::basic_string, std::allocator >); #if EIGEN_VERSION_AT_LEAST(3,3,0) #else // generated by autoexplicit.sh diff --git a/include/igl/reorder.cpp b/include/igl/reorder.cpp index 38bb2a070..4c6415023 100644 --- a/include/igl/reorder.cpp +++ b/include/igl/reorder.cpp @@ -31,6 +31,8 @@ IGL_INLINE void igl::reorder( #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh +template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); +// generated by autoexplicit.sh template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); diff --git a/include/igl/sort.cpp b/include/igl/sort.cpp index e9111c9b6..b2709bea6 100644 --- a/include/igl/sort.cpp +++ b/include/igl/sort.cpp @@ -81,6 +81,17 @@ IGL_INLINE void igl::sort( } } +template +IGL_INLINE void igl::sort( + const Eigen::DenseBase& X, + const int dim, + const bool ascending, + Eigen::PlainObjectBase& Y) +{ + Eigen::Matrix< int, DerivedX::RowsAtCompileTime, DerivedX::ColsAtCompileTime > IX; + return sort(X,dim,ascending,Y,IX); +} + template IGL_INLINE void igl::sort_new( const Eigen::DenseBase& X, @@ -317,6 +328,18 @@ if(!ascending) #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh +template void igl::sort, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::sort, 1, -1, false>, Eigen::Matrix >(Eigen::DenseBase, 1, -1, false> > const&, int, bool, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::sort, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::sort, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::sort, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::sort, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh template void igl::sort, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::sort, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); @@ -343,6 +366,7 @@ template void igl::sort, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sort, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sort, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +template void igl::sort, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&); template void igl::sort, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sort, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sort, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); diff --git a/include/igl/sort.h b/include/igl/sort.h index f89f54b13..a7d3e7ad9 100644 --- a/include/igl/sort.h +++ b/include/igl/sort.h @@ -37,6 +37,12 @@ namespace igl const bool ascending, Eigen::PlainObjectBase& Y, Eigen::PlainObjectBase& IX); + template + IGL_INLINE void sort( + const Eigen::DenseBase& X, + const int dim, + const bool ascending, + Eigen::PlainObjectBase& Y); template // Only better if size(X,dim) is small IGL_INLINE void sort_new( diff --git a/include/igl/sortrows.cpp b/include/igl/sortrows.cpp index a5e084fd8..7c2407fc8 100644 --- a/include/igl/sortrows.cpp +++ b/include/igl/sortrows.cpp @@ -105,8 +105,24 @@ IGL_INLINE void igl::sortrows( } } +template +IGL_INLINE void igl::sortrows( + const Eigen::DenseBase& X, + const bool ascending, + Eigen::PlainObjectBase& Y) +{ + Eigen::Matrix I; + return igl::sortrows(X,ascending,Y,I); +} + #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation +// generated by autoexplicit.sh +template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); @@ -133,6 +149,7 @@ template void igl::sortrows, Eigen::Matri template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sortrows, Eigen::Matrix >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +template void igl::sortrows >(Eigen::DenseBase > const&, bool, Eigen::PlainObjectBase >&); #ifdef WIN32 template void igl::sortrows,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::DenseBase > const &,bool,class Eigen::PlainObjectBase > &,class Eigen::PlainObjectBase > &); template void igl::sortrows,class Eigen::Matrix<__int64,-1,1,0,-1,1> >(class Eigen::DenseBase > const &,bool,class Eigen::PlainObjectBase > &,class Eigen::PlainObjectBase > &); diff --git a/include/igl/sortrows.h b/include/igl/sortrows.h index c0b15f29e..a1e5db77f 100644 --- a/include/igl/sortrows.h +++ b/include/igl/sortrows.h @@ -32,6 +32,11 @@ namespace igl const bool ascending, Eigen::PlainObjectBase& Y, Eigen::PlainObjectBase& I); + template + IGL_INLINE void sortrows( + const Eigen::DenseBase& X, + const bool ascending, + Eigen::PlainObjectBase& Y); } #ifndef IGL_STATIC_LIBRARY diff --git a/include/igl/unique_rows.cpp b/include/igl/unique_rows.cpp index 1973a80c2..47910af77 100644 --- a/include/igl/unique_rows.cpp +++ b/include/igl/unique_rows.cpp @@ -74,6 +74,12 @@ IGL_INLINE void igl::unique_rows( #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation +// generated by autoexplicit.sh +template void igl::unique_rows, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::unique_rows, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +// generated by autoexplicit.sh +template void igl::unique_rows, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::unique_rows, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::unique_rows, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh diff --git a/include/igl/vector_area_matrix.cpp b/include/igl/vector_area_matrix.cpp index 6464c14a7..5438aa9dd 100644 --- a/include/igl/vector_area_matrix.cpp +++ b/include/igl/vector_area_matrix.cpp @@ -6,15 +6,13 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "vector_area_matrix.h" +#include "boundary_facets.h" #include // Bug in unsupported/Eigen/SparseExtra needs iostream first #include #include -//#include -#include - template IGL_INLINE void igl::vector_area_matrix( const Eigen::PlainObjectBase & F, diff --git a/tests/include/igl/accumarray.cpp b/tests/include/igl/accumarray.cpp index 3c9f344e2..4668f135a 100644 --- a/tests/include/igl/accumarray.cpp +++ b/tests/include/igl/accumarray.cpp @@ -20,3 +20,14 @@ TEST_CASE("accumarray: matlab_help", "[igl]") (Eigen::VectorXd(4) << 101,0,206,208).finished(); test_common::assert_eq(A,Agt); } + +TEST_CASE("accumarray: scalar", "[igl]") +{ + const auto n = + (Eigen::VectorXi(5) << 1,2,2,4,5).finished(); + Eigen::VectorXi C; + igl::accumarray(n,1,C); + const auto Cgt = + (Eigen::VectorXi(6) << 0,1,2,0,1,1).finished(); + test_common::assert_eq(C,Cgt); +} diff --git a/tests/include/igl/boundary_facets.cpp b/tests/include/igl/boundary_facets.cpp index b4f78b8e0..8f358ebe5 100644 --- a/tests/include/igl/boundary_facets.cpp +++ b/tests/include/igl/boundary_facets.cpp @@ -4,6 +4,9 @@ #include #include +#include +#include + TEST_CASE("boundary_facets: single_tet", "[igl]") { @@ -55,16 +58,39 @@ TEST_CASE("boundary_facets: single_cube", "[igl]") 5,7,4, 7,6,4).finished(); Eigen::MatrixXi F; - igl::boundary_facets(T,F); + Eigen::VectorXi J,K; + igl::boundary_facets(T,F,J,K); const auto sortF = [](const Eigen::MatrixXi & F)-> Eigen::MatrixXi { Eigen::MatrixXi sorted_F; - Eigen::MatrixXi _1; - igl::sort(F,2,true, sorted_F,_1); - igl::sortrows(Eigen::MatrixXi(sorted_F),true,sorted_F,_1); + igl::sort(F,2,true, sorted_F); + igl::sortrows(Eigen::MatrixXi(sorted_F),true,sorted_F); return sorted_F; }; Eigen::MatrixXi sorted_F = sortF(F); Eigen::MatrixXi sorted_Fgt = sortF(Fgt); test_common::assert_eq(sorted_Fgt,sorted_F); + for(int f = 0;f