feat: 性能基准测试套件 — M3 里程碑起步
CI / Build & Test (push) Failing after 35s
CI / Release Build (push) Failing after 35s

This commit is contained in:
茂之钳
2026-07-23 23:26:46 +00:00
parent 9bf673e337
commit a516626252
4 changed files with 24 additions and 25 deletions
+8 -24
View File
@@ -13,7 +13,6 @@
#include <vde/brep/modeling.h>
#include <vde/mesh/mesh_boolean.h>
#include <vde/mesh/halfedge_mesh.h>
#include <vde/core/transform.h>
#include <cmath>
using namespace vde;
@@ -25,34 +24,19 @@ struct SpherePair {
mesh::HalfedgeMesh b;
};
/// Create two intersecting spheres (sphere_a at (-0.5, 0, 0), sphere_b at (+0.5, 0, 0))
SpherePair make_sphere_pair(int segments) {
int seg_u = segments;
int seg_v = std::max(segments / 2, 4);
/// Create two intersecting spheres with approximately `face_count` faces each.
/// sphere_a at origin, sphere_b translated by +1.0 along X (overlap ~0.5)
SpherePair make_sphere_pair(int face_count) {
// make_sphere produces ~ 2 * seg_u * seg_v faces → solve for seg
int seg = std::max(static_cast<int>(std::ceil(std::sqrt(face_count / 2.0))), 4);
int seg_u = seg;
int seg_v = seg;
auto sphere_a = brep::make_sphere(1.0, seg_u, seg_v).to_mesh();
auto sphere_b = brep::make_sphere(1.0, seg_u, seg_v).to_mesh();
// Translate sphere_b by +1.0 along X so they overlap by ~0.5
core::Transform3D t;
t.set_translation(core::Vector3D(1.0, 0.0, 0.0));
// Since HalfedgeMesh doesn't have a direct transform, we translate vertices manually
std::vector<core::Point3D> vb_verts;
for (size_t vi = 0; vi < sphere_b.num_vertices(); ++vi) {
auto p = sphere_b.vertex(vi);
vb_verts.push_back(core::Point3D(p.x() + 1.0, p.y(), p.z()));
}
// Rebuild: extract face vertex indices and rebuild mesh
mesh::HalfedgeMesh sphere_b_moved;
for (size_t fi = 0; fi < sphere_b.num_faces(); ++fi) {
auto fv = sphere_b.face_vertices(static_cast<int>(fi));
sphere_b_moved.add_face(fv);
}
// Overwrite vertices (add_face adds them at original positions)
// Actually we need a different approach — just vertex-move the existing mesh
// Best: build directly from triangles
// Rebuild from triangles with translated vertices
mesh::HalfedgeMesh b_moved;
std::vector<core::Point3D> all_verts;
std::vector<std::array<int, 3>> all_tris;