Files
ViewDesignEngine/include/vde/core/voronoi.h
T

23 lines
622 B
C++
Raw Normal View History

#pragma once
#include "vde/core/point.h"
#include <vector>
#include <array>
namespace vde::core {
using foundation::Point2D;
using foundation::Point3D;
using foundation::Vector2D;
using foundation::Vector3D;
struct VoronoiCell {
Point2D site; // Generator point
std::vector<Point2D> vertices; // Cell boundary vertices
std::vector<std::array<int, 2>> edges; // Edge indices into vertices
};
/// 2D Voronoi diagram from Delaunay dual graph
/// Returns cells for each input point
std::vector<VoronoiCell> voronoi_2d(const std::vector<Point2D>& points);
} // namespace vde::core