/// bench_delaunay.cpp — 2D Delaunay triangulation benchmarks /// /// Metrics: /// Delaunay2D/N{size} — Bowyer-Watson triangulation time for N random points #include #include #include #include using namespace vde; namespace { std::vector random_points_2d(int n, double R = 1000.0) { std::mt19937 rng(42); std::uniform_real_distribution dist(-R, R); std::vector 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);