@@ -29,13 +29,11 std::vector<double> flatten(std::vector<double> xValues, std::vector<double> yVa | |||||
29 |
|
29 | |||
30 | auto result = std::vector<double>(); |
|
30 | auto result = std::vector<double>(); | |
31 | result.reserve(xValues.size() * 3); |
|
31 | result.reserve(xValues.size() * 3); | |
32 |
|
32 | for (int i = 0; i < xValues.size(); i++) { | ||
33 | while (!xValues.empty()) { |
|
33 | result.push_back(xValues[i]); | |
34 | result.insert(result.cend(), {xValues.front(), yValues.front(), zValues.front()}); |
|
34 | result.push_back(yValues[i]); | |
35 | xValues.erase(xValues.begin()); |
|
35 | result.push_back(zValues[i]); | |
36 | yValues.erase(yValues.begin()); |
|
36 | } | |
37 | zValues.erase(zValues.begin()); |
|
|||
38 | } |
|
|||
39 |
|
37 | |||
40 | return result; |
|
38 | return result; | |
41 | } |
|
39 | } |
General Comments 0
You need to be logged in to leave comments.
Login now