2026-07-23 06:27:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
#include "vde/core/point.h"
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <array>
|
|
|
|
|
|
|
|
|
|
namespace vde::core {
|
2026-07-23 08:19:24 +00:00
|
|
|
using foundation::Point2D;
|
|
|
|
|
using foundation::Point3D;
|
|
|
|
|
using foundation::Vector2D;
|
|
|
|
|
using foundation::Vector3D;
|
2026-07-23 06:27:43 +00:00
|
|
|
|
|
|
|
|
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
|