#include "readBF.h" #include "list_to_matrix.h" #include #include #include template < typename DerivedWI, typename DerivedP, typename DerivedC> IGL_INLINE bool igl::readBF( const std::string & filename, Eigen::PlainObjectBase & WI, Eigen::PlainObjectBase & P, Eigen::PlainObjectBase & C) { using namespace std; ifstream is(filename); if(!is.is_open()) { return false; } string line; std::vector vWI; std::vector vP; std::vector > vC; while(getline(is, line)) { int wi,p; double cx,cy,cz; if(sscanf(line.c_str(), "%d %d %lg %lg %lg",&wi,&p,&cx,&cy,&cz) != 5) { return false; } vWI.push_back(wi); vP.push_back(p); vC.push_back({cx,cy,cz}); } list_to_matrix(vWI,WI); list_to_matrix(vP,P); list_to_matrix(vC,C); return true; } #ifdef IGL_STATIC_LIBRARY template bool igl::readBF, Eigen::Matrix, Eigen::Matrix >(std::basic_string, std::allocator > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif