// 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 "bone_heat.h" #include "EmbreeIntersector.h" #include "bone_visible.h" #include "../project_to_line_segment.h" #include "../cotmatrix.h" #include "../massmatrix.h" #include "../mat_min.h" #include bool igl::embree::bone_heat( const Eigen::MatrixXd & V, const Eigen::MatrixXi & F, const Eigen::MatrixXd & C, const Eigen::VectorXi & P, const Eigen::MatrixXi & BE, const Eigen::MatrixXi & CE, Eigen::MatrixXd & W) { using namespace std; using namespace Eigen; assert(CE.rows() == 0 && "Cage edges not supported."); assert(C.cols() == V.cols() && "V and C should have same #cols"); assert(BE.cols() == 2 && "BE should have #cols=2"); assert(F.cols() == 3 && "F should contain triangles."); assert(V.cols() == 3 && "V should contain 3D positions."); const int n = V.rows(); const int np = P.rows(); const int nb = BE.rows(); const int m = np + nb; // "double sided lighting" MatrixXi FF; FF.resize(F.rows()*2,F.cols()); FF << F, F.rowwise().reverse(); // Initialize intersector EmbreeIntersector ei; ei.init(V.cast(),F.cast()); typedef Matrix VectorXb; typedef Matrix MatrixXb; MatrixXb vis_mask(n,m); // Distances MatrixXd D(n,m); // loop over points for(int j = 0;j 0) { cerr<<"Error: Cage edges are not supported. Ignored."<1e10?1e10:hii); } } SparseMatrix Q,L,M; cotmatrix(V,F,L); massmatrix(V,F,MASSMATRIX_TYPE_DEFAULT,M); const auto & H = Hdiag.asDiagonal(); Q = (-L+M*H); SimplicialLLT > llt; llt.compute(Q); switch(llt.info()) { case Eigen::Success: break; case Eigen::NumericalIssue: cerr<<"Error: Numerical issue."<