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:
@@ -81,4 +81,64 @@ struct TrimmedSurface {
|
||||
double u0, double u1, double v0, double v1);
|
||||
};
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// 曲面偏移
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
|
||||
/// 自交区域描述
|
||||
struct SelfIntersectionRegion {
|
||||
std::pair<double, double> u_range; ///< 自交区域在 u 参数方向的范围
|
||||
std::pair<double, double> v_range; ///< 自交区域在 v 参数方向的范围
|
||||
std::string intersection_type; ///< "overlap" 或 "tangent_crossing"
|
||||
};
|
||||
|
||||
/// 曲面偏移结果
|
||||
struct OffsetResult {
|
||||
curves::NurbsSurface offset_surface; ///< 偏移后的曲面
|
||||
bool has_self_intersection = false; ///< 是否检测到自交
|
||||
std::vector<SelfIntersectionRegion> self_intersection_regions; ///< 自交区域
|
||||
TrimmedSurface offset_trimmed; ///< 自动裁剪后的偏移曲面
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 沿法向偏移曲面
|
||||
*
|
||||
* 使用控制点偏移法(Greville 横坐标评估法向)构造偏移曲面。
|
||||
* 这是工业中 Parasolid/ACIS 的常用近似方法,精确偏移仅对可展曲面成立。
|
||||
*
|
||||
* 自动检测自交区域并构建裁剪曲面。
|
||||
*
|
||||
* @param surface 原始 NURBS 曲面
|
||||
* @param distance 偏移距离(正 = 法向正方向,负 = 反向)
|
||||
* @return OffsetResult 包含偏移曲面 + 自交信息 + 裁剪曲面
|
||||
*/
|
||||
[[nodiscard]] OffsetResult offset_surface(
|
||||
const curves::NurbsSurface& surface, double distance);
|
||||
|
||||
/**
|
||||
* @brief 检测曲面自交区域
|
||||
*
|
||||
* 通过网格采样 + 空间哈希检测参数域中不同位置映射到
|
||||
* 同一 3D 空间的区域。
|
||||
*
|
||||
* @param surface 待检测曲面
|
||||
* @param grid_res 采样网格分辨率(默认 50)
|
||||
* @return 自交区域列表
|
||||
*/
|
||||
[[nodiscard]] std::vector<SelfIntersectionRegion> detect_self_intersections(
|
||||
const curves::NurbsSurface& surface, int grid_res = 50);
|
||||
|
||||
/**
|
||||
* @brief 从裁剪曲面中移除自交区域
|
||||
*
|
||||
* 将检测到的自交区域作为内部孔洞裁剪掉。
|
||||
*
|
||||
* @param ts 原始裁剪曲面
|
||||
* @param regions 自交区域列表
|
||||
* @return 移除自交区域后的裁剪曲面
|
||||
*/
|
||||
[[nodiscard]] TrimmedSurface trim_self_intersections(
|
||||
const TrimmedSurface& ts,
|
||||
const std::vector<SelfIntersectionRegion>& regions);
|
||||
|
||||
} // namespace vde::brep
|
||||
|
||||
Reference in New Issue
Block a user