// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 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 "sort_triangles.h" #include "barycenter.h" #include "sort.h" #include "sortrows.h" #include "slice.h" #include "round.h" #include "colon.h" #include template < typename DerivedV, typename DerivedF, typename DerivedMV, typename DerivedP, typename DerivedFF, typename DerivedI> IGL_INLINE void igl::sort_triangles( const Eigen::MatrixBase & V, const Eigen::MatrixBase & F, const Eigen::MatrixBase & MV, const Eigen::MatrixBase & P, Eigen::PlainObjectBase & FF, Eigen::PlainObjectBase & I) { using namespace Eigen; using namespace std; typedef typename DerivedV::Scalar Scalar; // Barycenter, centroid Eigen::Matrix D,sD; Eigen::Matrix BC; barycenter(V,F,BC); Eigen::Matrix BC4(BC.rows(),4); BC4.leftCols(3) = BC; BC4.col(3).setConstant(1); D = BC4*( MV.template cast().transpose()* P.template cast().transpose().eval().col(2)); sort(D,1,false,sD,I); FF = F(I.derived(),Eigen::all); } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh template void igl::sort_triangles, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::sort_triangles, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif