85 lines
2.8 KiB
C++
85 lines
2.8 KiB
C++
|
|
#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
|