// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2015 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 "progressive_hulls_cost_and_placement.h" #include "quadprog.h" #include "../unique.h" #include "../circulation.h" #include #include #include IGL_INLINE void igl::copyleft::progressive_hulls_cost_and_placement( const int e, const Eigen::MatrixXd & V, const Eigen::MatrixXi & F, const Eigen::MatrixXi & E, const Eigen::VectorXi & EMAP, const Eigen::MatrixXi & EF, const Eigen::MatrixXi & EI, double & cost, Eigen::RowVectorXd & p) { using namespace Eigen; using namespace std; // Controls the amount of quadratic energy to add (too small will introduce // instabilities and flaps) const double w = 0.1; assert(V.cols() == 3 && "V.cols() should be 3"); // Gather list of unique face neighbors vector Nall = circulation(e, true,F,E,EMAP,EF,EI); vector Nother= circulation(e,false,F,E,EMAP,EF,EI); Nall.insert(Nall.end(),Nother.begin(),Nother.end()); vector N; igl::unique(Nall,N); // Gather: // A #N by 3 normals scaled by area, // D #N determinants of matrix formed by points as columns // B #N point on plane dot normal MatrixXd A(N.size(),3); VectorXd D(N.size()); VectorXd B(N.size()); //cout<<"N=["; for(int i = 0;i= B // A x - B >=0 // This is annoyingly necessary. Seems the solver is letting some garbage // slip by. success = success && ((A*x-B).minCoeff()>-1e-10); if(success) { p = x.transpose(); //assert(cost>=0 && "Cost should be positive"); }else { cost = std::numeric_limits::infinity(); //VectorXi NM; //igl::list_to_matrix(N,NM); //cout<