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:
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
/**
|
||||
* @file parallel_intersection.h
|
||||
* @brief 并行曲面/曲线求交
|
||||
*
|
||||
* OpenMP 并行化曲面-曲面求交和曲线-曲线求交。
|
||||
*
|
||||
* @ingroup curves
|
||||
*/
|
||||
|
||||
#include "vde/core/point.h"
|
||||
#include "vde/curves/nurbs_curve.h"
|
||||
#include "vde/curves/nurbs_surface.h"
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace vde::curves {
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// Parallel Curve Intersection
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
/**
|
||||
* @brief 并行计算一组曲线对的交点
|
||||
*
|
||||
* 每对曲线独立求交,结果线程安全合并。
|
||||
*
|
||||
* @param curve_pairs 曲线对列表 ((curve_a_idx, curve_b_idx), ...)
|
||||
* @param curves_a 曲线集合 A
|
||||
* @param curves_b 曲线集合 B
|
||||
* @return 每条曲线对的交点参数列表
|
||||
*/
|
||||
[[nodiscard]] std::vector<std::vector<std::pair<double, double>>>
|
||||
parallel_curve_intersections(
|
||||
const std::vector<std::pair<int, int>>& curve_pairs,
|
||||
const std::vector<NurbsCurve>& curves_a,
|
||||
const std::vector<NurbsCurve>& curves_b);
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// Parallel Surface Intersection
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
/// 曲面交线段
|
||||
struct SurfaceIntersectionSegment {
|
||||
core::Point3D start;
|
||||
core::Point3D end;
|
||||
double u_a_start, v_a_start;
|
||||
double u_a_end, v_a_end;
|
||||
double u_b_start, v_b_start;
|
||||
double u_b_end, v_b_end;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 并行计算两曲面的交线
|
||||
*
|
||||
* 递归细分 + 牛顿精化,边界盒预筛选,并行分发。
|
||||
*
|
||||
* @param surf_a 曲面 A
|
||||
* @param surf_b 曲面 B
|
||||
* @param tolerance 精度要求
|
||||
* @param max_refinements 最大细分次数
|
||||
* @return 交线段列表
|
||||
*/
|
||||
[[nodiscard]] std::vector<SurfaceIntersectionSegment>
|
||||
parallel_surface_intersection(
|
||||
const NurbsSurface& surf_a, const NurbsSurface& surf_b,
|
||||
double tolerance = 1e-6, int max_refinements = 10);
|
||||
|
||||
/**
|
||||
* @brief 并行批量曲面-曲面对求交
|
||||
*
|
||||
* @param pairs 曲面对索引
|
||||
* @param surfaces_a 曲面集合 A
|
||||
* @param surfaces_b 曲面集合 B
|
||||
* @return 每对曲面的交线段列表
|
||||
*/
|
||||
[[nodiscard]] std::vector<std::vector<SurfaceIntersectionSegment>>
|
||||
parallel_surface_intersections(
|
||||
const std::vector<std::pair<int, int>>& pairs,
|
||||
const std::vector<NurbsSurface>& surfaces_a,
|
||||
const std::vector<NurbsSurface>& surfaces_b,
|
||||
double tolerance = 1e-6);
|
||||
|
||||
} // namespace vde::curves
|
||||
Reference in New Issue
Block a user