// 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 "readCSV.h" #include #include #include #include #include template IGL_INLINE bool igl::readCSV( const std::string str, Eigen::Matrix& M) { using namespace std; std::vector > Mt; std::ifstream infile(str.c_str()); std::string line; while (std::getline(infile, line)) { std::istringstream iss(line); vector temp; Scalar a; while (iss >> a) temp.push_back(a); if (temp.size() != 0) // skip empty lines Mt.push_back(temp); } if (Mt.size() != 0) { // Verify that it is indeed a matrix for (unsigned i = 0; i