33 std::vector<double> coords;
34 coords.reserve(std::distance(begin, end) * 2);
36 std::for_each(begin, end, [&](
const Vector2f& vec) {
37 coords.push_back(
static_cast<double>(vec.
x));
38 coords.push_back(
static_cast<double>(vec.
y));
41 delaunator::Delaunator d(coords);
43 std::pair<std::vector<Vector2f>, std::vector<unsigned int>> output;
44 std::vector<Vector2f>& vertices = output.first;
45 std::vector<unsigned int>& elements = output.second;
47 elements.reserve(d.triangles.size());
48 std::transform(d.triangles.begin(), d.triangles.end(), std::back_inserter(elements), [](
size_t index) {
49 return static_cast<unsigned int>(index);
52 vertices.reserve(d.coords.size() / 2);
53 for (
size_t i = 0; i < d.coords.size(); i += 2)
54 vertices.emplace_back(
static_cast<float>(d.coords[i]),
static_cast<float>(d.coords[i+1]));
66 std::vector<double> coords;
67 coords.reserve(std::distance(begin, end) * 2);
69 for (
const Vector2f* it = begin; it != end; ++it) {
71 coords.push_back(
static_cast<double>(vec.
x));
72 coords.push_back(
static_cast<double>(vec.
y));
75 delaunator::Delaunator d(coords);
77 std::pair<std::vector<float>, std::vector<unsigned int>> output;
78 std::vector<float>& vertices = output.first;
79 std::vector<unsigned int>& elements = output.second;
81 elements.reserve(d.triangles.size());
82 std::transform(d.triangles.begin(), d.triangles.end(), std::back_inserter(elements), [](
size_t index) {
83 return static_cast<unsigned int>(index);
86 vertices.reserve(d.coords.size());
87 std::transform(d.coords.begin(), d.coords.end(), std::back_inserter(vertices), [](
double value) {
88 return static_cast<float>(value);