Files
茂之钳 9bf673e337
CI / Build & Test (push) Failing after 37s
CI / Release Build (push) Failing after 43s
fix: Delaunay3D circumcenter 完整实现 + 测试恢复
2026-07-23 23:22:35 +00:00

36 lines
989 B
C++

/// bench_delaunay.cpp — 2D Delaunay triangulation benchmarks
///
/// Metrics:
/// Delaunay2D/N{size} — Bowyer-Watson triangulation time for N random points
#include <benchmark/benchmark.h>
#include <vde/mesh/delaunay_2d.h>
#include <random>
#include <vector>
using namespace vde;
namespace {
std::vector<core::Point2D> random_points_2d(int n, double R = 1000.0) {
std::mt19937 rng(42);
std::uniform_real_distribution<double> dist(-R, R);
std::vector<core::Point2D> pts;
pts.reserve(n);
for (int i = 0; i < n; ++i)
pts.emplace_back(dist(rng), dist(rng));
return pts;
}
} // namespace
static void Delaunay2D(benchmark::State& state) {
auto pts = random_points_2d(state.range(0));
for (auto _ : state) {
auto result = mesh::delaunay_2d(pts);
benchmark::DoNotOptimize(result.triangles.size());
}
state.SetItemsProcessed(state.iterations() * state.range(0));
}
BENCHMARK(Delaunay2D)->Arg(100)->Arg(1000)->Arg(10000);