forked from meshpro/pygalmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generate_from_inr_feature_input function included, reads polylines file
- Loading branch information
Showing
5 changed files
with
239 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef READ_POLYLINES_H | ||
#define READ_POLYLINES_H | ||
|
||
#include <cstddef> | ||
#include <vector> | ||
#include <fstream> | ||
|
||
template <typename Point_3> | ||
bool read_polylines(const std::string fname, | ||
std::vector<std::vector<Point_3> >& polylines) | ||
{ | ||
std::ifstream ifs(fname); | ||
if(ifs.bad()) return false; | ||
std::size_t n; | ||
while(ifs >> n) { | ||
polylines.resize(polylines.size()+1); | ||
std::vector<Point_3>& polyline = polylines.back(); | ||
while(n-- != 0) { | ||
Point_3 p; | ||
ifs >> p; | ||
if(ifs.fail()) return false; | ||
polyline.push_back(p); | ||
} | ||
} | ||
if(ifs.bad()) return false; | ||
else return ifs.eof(); | ||
} | ||
|
||
#endif // READ_POLYLINES_H |