feat(v4.6): memory pool + parallel boolean/MC/intersection + GMP exact predicates
M1 — Memory Pool (内存池): - ObjectPool<T>: O(1) acquire/release with free-list, chunk-based expansion - ThreadSafeObjectPool<T>: per-thread local pools with global fallback - CowPtr<T>: copy-on-write smart pointer with shallow/deep copy - 10 tests: single/multi-thread, CoW detach, reuse rate M2 — Parallel Boolean (并行布尔): - parallel_face_face_intersection(): OpenMP face-pair dispatch with AABB culling - parallel_classify_faces(): thread-safe ray casting classification - parallel_mesh_union/intersection/difference + B-Rep variants - Thread count management API - 12 tests: coverage, empty cases, identity operations M3 — Parallel Marching Cubes (并行MC): - parallel_marching_cubes(): Z-slice parallel voxel processing - parallel_adaptive_mc(): octree-based adaptive resolution - Complete 256-entry edge table + Möller-Trumbore interpolation - 5 tests: sphere basic/high-res/empty/adaptive/threaded M4 — Parallel Surface Intersection (并行求交): - parallel_curve_intersections(): per-pair parallel dispatch - parallel_surface_intersection(): recursive subdivision + Newton refinement - AABB broad-phase culling before narrow-phase - 4 tests: curve pairs, surface batch M5 — GMP Exact Predicates (精确谓词): - exact_orient2d/3d: adaptive precision (double → GMP fallback) - exact_in_sphere: circumsphere test with degenerate handling - exact_point_in_polygon/polyhedron: robust ray casting - PrecisionMode: Fast/Adaptive/Exact with global toggle - 12 tests: all orientations, boundary cases, mode switching 21 files, +2263 lines
This commit is contained in:
@@ -2,3 +2,4 @@ add_vde_test(test_bezier)
|
||||
add_vde_test(test_nurbs)
|
||||
add_vde_test(test_nurbs_operations)
|
||||
add_vde_test(test_surface_intersection)
|
||||
add_vde_test(test_parallel_intersection)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "vde/curves/parallel_intersection.h"
|
||||
#include <cmath>
|
||||
|
||||
using namespace vde::curves;
|
||||
using namespace vde::core;
|
||||
|
||||
// Helper: create a simple NURBS line from (0,0) to (1,0)
|
||||
static NurbsCurve make_line_curve() {
|
||||
std::vector<Point3D> cp = {{0,0,0}, {1,0,0}};
|
||||
std::vector<double> knots = {0, 0, 1, 1};
|
||||
std::vector<double> weights = {1, 1};
|
||||
return NurbsCurve(cp, knots, weights, 1);
|
||||
}
|
||||
|
||||
TEST(ParallelIntersectionTest, CurveIntersection_Empty) {
|
||||
auto results = parallel_curve_intersections({}, {}, {});
|
||||
EXPECT_EQ(results.size(), 0u);
|
||||
}
|
||||
|
||||
TEST(ParallelIntersectionTest, CurveIntersection_SinglePair) {
|
||||
auto c1 = make_line_curve();
|
||||
auto c2 = make_line_curve();
|
||||
std::vector<std::pair<int,int>> pairs = {{0, 0}};
|
||||
|
||||
auto results = parallel_curve_intersections(pairs,
|
||||
std::vector<NurbsCurve>{c1},
|
||||
std::vector<NurbsCurve>{c2});
|
||||
EXPECT_EQ(results.size(), 1u);
|
||||
}
|
||||
|
||||
TEST(ParallelIntersectionTest, SurfaceIntersection_Empty) {
|
||||
// Create two planes
|
||||
NurbsSurface a, b;
|
||||
auto results = parallel_surface_intersection(a, b);
|
||||
EXPECT_EQ(results.size(), 0u);
|
||||
}
|
||||
|
||||
TEST(ParallelIntersectionTest, SurfaceIntersection_Batch) {
|
||||
std::vector<std::pair<int,int>> pairs;
|
||||
auto results = parallel_surface_intersections(pairs, {}, {});
|
||||
EXPECT_EQ(results.size(), 0u);
|
||||
}
|
||||
Reference in New Issue
Block a user