fix: Delaunay3D circumcenter 完整实现 + 测试恢复
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/// 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);
|
||||
Reference in New Issue
Block a user