// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2014 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 "centroid.h" #include template < typename DerivedV, typename DerivedF, typename Derivedc, typename Derivedvol> IGL_INLINE void igl::centroid( const Eigen::PlainObjectBase& V, const Eigen::PlainObjectBase& F, Eigen::PlainObjectBase& cen, Derivedvol & vol) { using namespace Eigen; assert(F.cols() == 3 && "F should contain triangles."); assert(V.cols() == 3 && "V should contain 3d points."); const int m = F.rows(); cen.setZero(); vol = 0; // loop over faces for(int f = 0;f IGL_INLINE void igl::centroid( const Eigen::PlainObjectBase& V, const Eigen::PlainObjectBase& F, Eigen::PlainObjectBase& c) { typename Derivedc::Scalar vol; return centroid(V,F,c,vol); } #ifdef IGL_STATIC_LIBRARY template void igl::centroid, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); #endif