23 std::vector<std::string>* errors)
26 std::ifstream in(fname.c_str());
29 WARN(
"readTIN(): could not open stream from {:s}.", fname);
32 errors->push_back(
"readTINFile error opening stream from " + fname);
43 while (std::getline(in, line).good())
52 std::stringstream input(line);
61 if (!(input >> p0[0] >> p0[1] >> p0[2]))
63 ERR(
"Could not read coords of 1st point of triangle {:d}.",
id);
67 std::string(
"readTIN error: ") +
69 "Could not read coords of 1st point in triangle ") +
77 if (!(input >> p1[0] >> p1[1] >> p1[2]))
79 ERR(
"Could not read coords of 2nd point of triangle {:d}.",
id);
83 std::string(
"readTIN error: ") +
85 "Could not read coords of 2nd point in triangle ") +
93 if (!(input >> p2[0] >> p2[1] >> p2[2]))
95 ERR(
"Could not read coords of 3rd point of triangle {:d}.",
id);
99 std::string(
"readTIN error: ") +
101 "Could not read coords of 3rd point in triangle ") +
110 double const d_eps(std::numeric_limits<double>::epsilon());
113 ERR(
"readTIN: Triangle {:d} has zero area.",
id);
116 errors->push_back(std::string(
"readTIN: Triangle ") +
118 std::string(
" has zero area."));
125 std::size_t
const s(pnt_vec.
getVector().size());
127 std::size_t
const pnt_pos_0(
129 std::size_t
const pnt_pos_1(
131 std::size_t
const pnt_pos_2(
134 if (pnt_pos_0 != std::numeric_limits<std::size_t>::max() &&
135 pnt_pos_1 != std::numeric_limits<std::size_t>::max() &&
136 pnt_pos_2 != std::numeric_limits<std::size_t>::max())
138 sfc->addTriangle(pnt_pos_0, pnt_pos_1, pnt_pos_2);
142 if (sfc->getNumberOfTriangles() == 0)
144 WARN(
"readTIN(): No triangle found.", fname);
147 errors->push_back(
"readTIN error because of no triangle found");