Transforms an array of 2D vectors into a contiguous array of scalars
| 123 | |
| 124 | // Transforms an array of 2D vectors into a contiguous array of scalars |
| 125 | std::vector<float> flatten(const sf::Vector2f* vectorArray, std::size_t length) |
| 126 | { |
| 127 | const std::size_t vectorSize = 2; |
| 128 | |
| 129 | std::vector<float> contiguous(vectorSize * length); |
| 130 | for (std::size_t i = 0; i < length; ++i) |
| 131 | { |
| 132 | contiguous[vectorSize * i] = vectorArray[i].x; |
| 133 | contiguous[vectorSize * i + 1] = vectorArray[i].y; |
| 134 | } |
| 135 | |
| 136 | return contiguous; |
| 137 | } |
| 138 | |
| 139 | // Transforms an array of 3D vectors into a contiguous array of scalars |
| 140 | std::vector<float> flatten(const sf::Vector3f* vectorArray, std::size_t length) |