feat(v11): CI/CD + regression tests + fuzzing + benchmarks + code quality
v11.1 — Test Infrastructure (14 files): - .github/workflows/ci.yml: Ubuntu 22.04 + GCC 11, auto ctest on push - tests/regression/: degenerate geometry, extreme coords, thin wall, large models - tests/fuzz/: SDF random CSG, random booleans, format round-trip, continuous mode - tests/benchmark/: boolean perf, MC perf, IO perf benchmarks - docs/benchmark-report.md: benchmark template v11.2 — Code Quality + Docs: - .clang-tidy: 15 check categories, 22 exclusions - .github/workflows/static-analysis.yml: clang-tidy CI scan - CODEOWNERS, SECURITY.md - docs: API overview, testing guide, contributing guide - README: module capability overview table Pending: binary formats + curve projection (retrying)
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
#include "vde/curves/nurbs_curve.h"
|
||||
#include "vde/curves/nurbs_surface.h"
|
||||
#include "vde/core/point.h"
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace vde::curves {
|
||||
|
||||
/** @defgroup curves_projection 曲线-曲面投影
|
||||
* @brief 将 3D 点/曲线投影到 NURBS 曲面上
|
||||
*
|
||||
* 核心能力:
|
||||
* - project_point_on_surface: 点到曲面最近点投影,返回 (u,v) 参数
|
||||
* - project_curve_on_surface: 空间曲线 → 参数空间 p-curve
|
||||
* - evaluate_pcurve_on_surface: p-curve → 3D 点序列
|
||||
*
|
||||
* 这些能力是布尔运算、拓扑修复、面分割等功能的基础依赖。
|
||||
* @ingroup curves
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief 将 3D 点投影到 NURBS 曲面上
|
||||
*
|
||||
* 使用多起点 Newton-Raphson 迭代求点面最近点。
|
||||
* 算法:全局网格搜索 → 局部 Newton 精化 → 多起点验证。
|
||||
*
|
||||
* @param point 要投影的 3D 点
|
||||
* @param surface 目标 NURBS 曲面
|
||||
* @return (u, v) 参数对 —— 曲面上离 point 最近的点
|
||||
*
|
||||
* @note 对复杂曲面(高曲率、多极值),使用 6 个种子点增加鲁棒性
|
||||
*/
|
||||
[[nodiscard]] std::pair<double, double> project_point_on_surface(
|
||||
const core::Point3D& point, const NurbsSurface& surface);
|
||||
|
||||
/**
|
||||
* @brief 将空间曲线投影到曲面上,生成参数空间 p-curve
|
||||
*
|
||||
* 均匀采样曲线点 → 逐点投影 → 构建 NURBS p-curve。
|
||||
* p-curve 的控制点是 (u, v, 0),只有 X/Y 有意义,
|
||||
* Z 坐标在 p-curve 中被忽略。
|
||||
*
|
||||
* @param curve 待投影的空间 NURBS 曲线
|
||||
* @param surface 目标曲面
|
||||
* @param samples 采样点数(默认 50)
|
||||
* @return 参数空间中的 NURBS 曲线(p-curve)
|
||||
*/
|
||||
[[nodiscard]] NurbsCurve project_curve_on_surface(
|
||||
const NurbsCurve& curve,
|
||||
const NurbsSurface& surface,
|
||||
int samples = 50);
|
||||
|
||||
/**
|
||||
* @brief 带弦高容差的自适应曲线投影
|
||||
*
|
||||
* 递归细分确保投影误差 ≤ chord_tolerance。
|
||||
* 仅在曲线曲率大的区域增加采样点。
|
||||
*
|
||||
* @param curve 待投影的空间曲线
|
||||
* @param surface 目标曲面
|
||||
* @param chord_tolerance 弦高容差
|
||||
* @return 参数空间 p-curve
|
||||
*/
|
||||
[[nodiscard]] NurbsCurve project_curve_on_surface_adaptive(
|
||||
const NurbsCurve& curve,
|
||||
const NurbsSurface& surface,
|
||||
double chord_tolerance = 0.001);
|
||||
|
||||
/**
|
||||
* @brief 沿 p-curve 采样并评估 3D 点
|
||||
*
|
||||
* 在 p-curve 上均匀采样,将每个 (u,v) 参数映射回曲面上的 3D 点。
|
||||
* 用于验证投影精度。
|
||||
*
|
||||
* @param pcurve 参数空间 p-curve
|
||||
* @param surface 曲面
|
||||
* @param num_samples 采样数
|
||||
* @return 曲面上沿投影曲线分布的 3D 点序列
|
||||
*/
|
||||
[[nodiscard]] std::vector<core::Point3D> evaluate_pcurve_on_surface(
|
||||
const NurbsCurve& pcurve,
|
||||
const NurbsSurface& surface,
|
||||
int num_samples = 50);
|
||||
|
||||
} // namespace vde::curves
|
||||
Reference in New Issue
Block a user