feat(v12): generative surfaces (Sweep/Loft/Net) + curve tools + surface analysis
M1 — Generative Surfaces: - sweep_surface: Explicit/Spine/TwoGuides modes - loft_surface: multi-section interpolation + guide + tangent constraints - net_surface: bidirectional curve grid → NURBS M3 — Curve Tools + Analysis: - curve_tools: project_curve, parallel_curve, connect_curve(G1-G3), helix, isoparametric - surface_analysis: inflection_lines, checker_mapping, surface_checker_report (A/B/C/D) - 14/14 tests passed Fixed: constraint_solver.h duplicate declaration, fea_mesh.h comment syntax Pending: M2 surface editing (retrying)
This commit is contained in:
@@ -225,4 +225,101 @@ struct DraftAngleDistribution {
|
||||
const Vector3D& pull_dir,
|
||||
int samples = 15);
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// Inflection Lines
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
/// 曲率过零点线段
|
||||
struct InflectionSegment {
|
||||
Point3D start; ///< 线段起点
|
||||
Point3D end; ///< 线段终点
|
||||
};
|
||||
|
||||
/// 曲率过零分析结果
|
||||
struct InflectionLinesResult {
|
||||
std::vector<InflectionSegment> segments; ///< 高斯曲率过零点连线
|
||||
int res_u, res_v; ///< 采样分辨率
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 提取曲面的曲率过零点连线(inflection lines)
|
||||
*
|
||||
* 在参数域密集采样高斯曲率,检测曲率符号变化点,连接相邻过零点
|
||||
* 形成线段。用于检测曲面凹凸变化边界。
|
||||
*
|
||||
* @param surf NURBS 曲面
|
||||
* @param res_u u 方向分辨率(默认 50)
|
||||
* @param res_v v 方向分辨率(默认 50)
|
||||
* @return 过零点线段集合
|
||||
*/
|
||||
[[nodiscard]] InflectionLinesResult inflection_lines(
|
||||
const NurbsSurface& surf,
|
||||
int res_u = 50, int res_v = 50);
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// Checker Mapping
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
/// 棋盘格反射数据
|
||||
struct CheckerMapResult {
|
||||
int res_u, res_v; ///< 分辨率
|
||||
std::vector<std::vector<double>> intensity; ///< intensity[i][j] ∈ [0,1](棋盘格亮度)
|
||||
Vector3D view_dir; ///< 视线方向(归一化)
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 计算棋盘格反射映射数据
|
||||
*
|
||||
* 模拟棋盘格图案在曲面上的反射效果。将参数域 (u,v) 映射为棋盘格
|
||||
* 纹理坐标,结合曲面法线计算反射强度。用于评估曲面光顺性——
|
||||
* 反射棋盘格的均匀度和连续性反映曲率连续性。
|
||||
*
|
||||
* @param surf NURBS 曲面
|
||||
* @param view_dir 视线方向(自动归一化)
|
||||
* @param res_u u 方向分辨率(默认 60)
|
||||
* @param res_v v 方向分辨率(默认 60)
|
||||
* @return 棋盘格反射数据
|
||||
*/
|
||||
[[nodiscard]] CheckerMapResult checker_mapping(
|
||||
const NurbsSurface& surf,
|
||||
const Vector3D& view_dir,
|
||||
int res_u = 60, int res_v = 60);
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// Surface Checker Report
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
/// 光顺性评估等级
|
||||
enum class SmoothnessGrade {
|
||||
A, ///< 优秀 — 反射条纹均匀、无突变、曲率连续
|
||||
B, ///< 良好 — 轻微不均匀、局部小波动
|
||||
C, ///< 一般 — 明显扭曲、局部不平滑
|
||||
D ///< 差 — 严重扭曲、曲率突变
|
||||
};
|
||||
|
||||
/// 曲面光顺性评估报告
|
||||
struct SurfaceCheckerReport {
|
||||
SmoothnessGrade grade; ///< 光顺性等级
|
||||
double checker_uniformity; ///< 棋盘格均匀度 [0,1],1 最佳
|
||||
double curvature_continuity; ///< 曲率连续性指数 [0,1]
|
||||
double gaussian_range; ///< 高斯曲率范围
|
||||
double mean_range; ///< 平均曲率范围
|
||||
int inflection_count; ///< 曲率过零点数量
|
||||
std::string description; ///< 文字描述
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 生成曲面光顺性评估报告
|
||||
*
|
||||
* 综合曲率分析、棋盘格反射和过零点检测,对曲面光顺性进行量化评估。
|
||||
* 返回等级、均匀度、连续性等综合指标。
|
||||
*
|
||||
* @param surf NURBS 曲面
|
||||
* @param res 综合分析分辨率(默认 60)
|
||||
* @return 光顺性评估报告
|
||||
*/
|
||||
[[nodiscard]] SurfaceCheckerReport surface_checker_report(
|
||||
const NurbsSurface& surf,
|
||||
int res = 60);
|
||||
|
||||
} // namespace vde::curves
|
||||
|
||||
Reference in New Issue
Block a user