// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2020 Oded Stein // // 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 "cr_vector_mass.h" #include #include "orient_halfedges.h" #include "doublearea.h" #include "squared_edge_lengths.h" template IGL_INLINE void igl::cr_vector_mass( const Eigen::MatrixBase& V, const Eigen::MatrixBase& F, const Eigen::MatrixBase& E, Eigen::SparseMatrix& M) { Eigen::Matrix dblA; doublearea(V,F,dblA); cr_vector_mass_intrinsic(F, dblA, E, M); } template < typename DerivedV, typename DerivedF, typename DerivedE, typename ScalarM> IGL_INLINE void igl::cr_vector_mass( const Eigen::MatrixBase& V, const Eigen::MatrixBase& F, Eigen::PlainObjectBase& E, Eigen::SparseMatrix& M) { if(E.rows()!=F.rows() || E.cols()!=F.cols()) { DerivedE oE; orient_halfedges(F, E, oE); } const Eigen::PlainObjectBase& cE = E; cr_vector_mass(V, F, cE, M); } template IGL_INLINE void igl::cr_vector_mass_intrinsic( const Eigen::MatrixBase& F, const Eigen::MatrixBase& dA, const Eigen::MatrixBase& E, Eigen::SparseMatrix& M) { assert(F.cols()==3 && "Faces have three vertices"); assert(E.rows()==F.rows() && E.cols()==F.cols() && "Wrong dimension in edge vectors"); const Eigen::Index m = F.rows(); const typename DerivedE::Scalar nE = E.maxCoeff() + 1; std::vector > tripletList; tripletList.reserve(2*3*m); for(Eigen::Index f=0; f, Eigen::Matrix, Eigen::Matrix, double>(Eigen::MatrixBase> const&, Eigen::MatrixBase> const&, Eigen::PlainObjectBase>&, Eigen::SparseMatrix&); #endif