// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2016 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // 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 "unique_simplices.h" #include "sort.h" #include "unique_rows.h" #include "parallel_for.h" template < typename DerivedF, typename DerivedFF, typename DerivedIA, typename DerivedIC> IGL_INLINE void igl::unique_simplices( const Eigen::MatrixBase& F, Eigen::PlainObjectBase& FF, Eigen::PlainObjectBase& IA, Eigen::PlainObjectBase& IC) { // IA and IC need to have RowsAtCompileTime == 1 or ColsAtCompileTime == 1 static_assert( (DerivedIA::RowsAtCompileTime == 1 || DerivedIA::ColsAtCompileTime == 1) && (DerivedIC::RowsAtCompileTime == 1 || DerivedIC::ColsAtCompileTime == 1), "IA and IC need to have RowsAtCompileTime == 1 or ColsAtCompileTime == 1"); using namespace Eigen; using namespace std; typedef Eigen::Matrix MatrixXI; // Sort each face MatrixXI sortF, unusedI; igl::sort(F,2,true,sortF,unusedI); // Find unique faces MatrixXI C; igl::unique_rows(sortF,C,IA,IC); FF.resize(IA.size(),F.cols()); const size_t mff = FF.rows(); parallel_for(mff,[&F,&IA,&FF](size_t & i) { FF.row(i) = F.row(IA(i)).template cast(); },1000ul); } template < typename DerivedF, typename DerivedFF> IGL_INLINE void igl::unique_simplices( const Eigen::MatrixBase& F, Eigen::PlainObjectBase& FF) { Eigen::VectorXi IA,IC; return unique_simplices(F,FF,IA,IC); } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::unique_simplices, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::unique_simplices, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&); template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::unique_simplices, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #ifdef WIN32 template void igl::unique_simplices, class Eigen::Matrix, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, class Eigen::Matrix<__int64, -1, 1, 0, -1, 1> >(class Eigen::MatrixBase > const &, class Eigen::PlainObjectBase > &, class Eigen::PlainObjectBase > &, class Eigen::PlainObjectBase > &); #endif #endif