12 KiB
ViewDesignEngine 全工程实现完整性审计报告
生成日期:2026-08-02 审计分支:audit/implementation-gaps 审计范围:src/ (164 .cpp 文件), include/vde/ (186 .h 文件), tests/ (162 .cpp 文件)
注(2026-08 模块拆分后归属更新):
gizmo_transform/view_frustum_cull等视口 API 归属vde_ui(命名空间vde::ui),平台函数(make_temp_file/delete_file等)归属vde_platform(vde::platform),并发/性能工具归属vde_infra。
总览统计
| 类别 | 数量 |
|---|---|
| 空壳实现(P0 严重) | 7 个文件,13+ 个函数 |
| 空壳实现(P1 重要) | 3 个函数体内局部 stub |
| 未测试公开函数(全部优先级) | 176 个 |
| 公开函数头文件声明总数 | 901 个 |
| 测试文件个数 | 162 个 |
第一部分:空壳实现清单
P0 严重 — 核心功能完全空壳
1. src/curves/exact_offset.cpp(5 行)
| 行号 | 函数 | 问题 |
|---|---|---|
| 3 | exact_offset(const NurbsSurface&, double) |
(void)distance; return surf; — 完全不偏移,返回原曲面 |
| 4 | offset_with_trimming(const NurbsSurface&, double) |
(void)distance; return {surf}; — 完全不做偏移和裁剪 |
影响:精确偏移是 CAD 核心操作,当前实现完全为空壳。任何依赖精确偏移的下游功能(如抽壳、加厚)均无法正确工作。
2. src/brep/flexible_assembly.cpp(9 行)
| 行号 | 函数 | 问题 |
|---|---|---|
| 8 | create_flexible_assembly(Assembly&, const std::vector<BrepModel>&, const std::vector<int>&) |
(void)assembly;(void)parts;(void)deformable_ids; — 三个参数全部丢弃,无任何操作 |
影响:柔性装配功能完全未实现,对标 CATIA Flexible Assembly 的核心功能缺失。
3. src/brep/fastener_library.cpp(16 行)
| 行号 | 函数 | 问题 |
|---|---|---|
| 4-7 | create_bolt(double d, double len, double pitch) |
(void)pitch; — 忽略螺距参数,返回简化圆柱体(不是真实螺栓) |
| 9 | create_nut(double d, double t) |
(void)t; return make_box(d,d,d*0.8); — 忽略厚度,返回方块(不是螺母) |
| 10-11 | create_washer(double id, double od, double t) |
(void)id;(void)od;(void)t; — 三个参数全部丢弃,返回圆柱体(不是垫圈) |
| 13-14 | create_threaded_hole(double d, double depth, double p) |
(void)p; — 忽略螺距,返回普通圆柱体(无螺纹) |
影响:紧固件库完全不可用。所有标准件(螺栓、螺母、垫圈、螺纹孔)均以错误形状返回。任何依赖紧固件库的装配功能均受影响。
4. src/brep/defeature.cpp(29 行)
| 行号 | 函数 | 问题 |
|---|---|---|
| 8-12 | defeature(const BrepModel&, const std::vector<RecognizedFeature>&) |
(void)features; — 忽略特征列表,直接返回原 body |
| 19-23 | remove_fillets(const BrepModel&, double max_radius) |
(void)max_radius; — 忽略半径参数,直接返回原 body |
影响:去特征(defeature)是 CAE 前处理的关键步骤。remove_holes() 虽然调用了 recognize_features(),但最终的 defeature() 不做任何处理。simplify_for_meshing() 链式调用也全部无效。
P1 重要 — 部分功能或子路径空壳
5. src/curves/iga_prep.cpp(194 行)— 3 个函数名不符实
| 行号 | 函数 | 问题 |
|---|---|---|
| 22-28 | compute_bezier_extraction_1d(/*knots*/, int degree, int /*span_start*/) |
参数 knots 和 span_start 被注释掉,返回单位矩阵。Bézier 提取矩阵未正确计算。 |
| 140-155 | degree_elevation(const NurbsSurface&, int du, int dv) |
返回 result.surface = surface — 完全没有升阶。注释承认"完整实现需使用算法 A5.9 (Piegl & Tiller)"。 |
| 161-192 | bezier_extraction(const NurbsSurface&) |
返回单位矩阵算子。Bézier 提取为恒等变换,实际未做任何操作。 |
影响:IGA(等几何分析)准备流程中,节点插入缺少控制点更新(重新计算后的曲面未使用),升阶完全未实现,Bézier 提取为恒等。这影响所有 IGA 前处理流水线。
6. src/curves/nurbs_operations.cpp — knot_insertion 局部问题
knot_insertion() 函数(位于 iga_prep.cpp 101-134 行)构建了 refined 曲面,但最终返回的是未修改的 surface 而非 refined,节点插入完全无效。
7. src/mesh/mesh_quality.cpp 第 330 行
case ElementType::Quad:
case ElementType::Hex:
// Stub — not implemented yet
eq.total_elements = 0;
Quad/Hex 单元质量评估为空壳,仅覆盖 Tet 和 Tri 类型。
第二部分:未测试公开函数清单
从 186 个头文件中提取 901 个公开函数声明,交叉对比 162 个测试文件中的调用,发现 176 个函数未被任何测试覆盖。
按模块分类
brep 模块(62 个未测试)
adaptive_tolerance, add_edge_unique, add_entry, add_vertex_unique, apply_joint_transform, are_conflicting, body_center_of_mass, body_surface_area, body_volume, cache_from_body, chamfer_by_position, check_part_interference, clearance_distance, collect_parts, compute_angularity, compute_circular_runout, compute_circularity, compute_cylindricity, compute_explode_displacement, compute_jacobian, compute_profile_of_surface, compute_straightness, compute_symmetry, compute_total_runout, compute_transformed_bounds, constraint_impact, defeature, detect_tangent_contact, edge_from_point, edge_length, envelope_principle_default, evaluate_closure, evaluate_constraints, evaluate_single_constraint, face_bounds, face_from_point, fillet_by_position, gdt_expected_datums, gdt_requires_datum, getBodyIndex, gizmo_transform, has_undercut, is_crease_edge, is_part, is_valid_standard, listener_count, make_rib, mmc_default, scene_bounds, set_body_material, set_vertex_point, shape_fillet, shell_by_position, vertex_from_point, vertex_normal, view_frustum_cull, fuzzy_gt, fuzzy_lt
curves/surface 模块(12 个未测试)
fair_surface_legacy, is_degenerate, is_g2_continuous, de_casteljau, project_curve_on_surface_adaptive, surface_torsion, coons_interpolate, extract_boundary_curves
mesh 模块(10 个未测试)
alpha_shapes, compute_curvature, fit_nurbs_least_squares, has_intensity, pca_normal, sdf_smooth_subtraction, sdf_smooth_union, smooth_hc_laplacian, tet_scaled_jacobian, tri_scaled_jacobian
core 模块(25 个未测试)
aabb_intersect_batch, aabb_intersect_batch_simd, add_task, base32_encode, cache_line_count, decompress_brep, delete_file, dot3, edgebreaker_decompress, exact_point_in_polyhedron, intersect4_count, invalidate_soa, is_convex, make_temp_file, mirror, mirror_about_plane, perimeter, prefetch_array, project, rotate, rotate_y, run_command, serialize, set_aos, simplify
foundation 模块(15 个未测试)
absolute, angular, cmp, deserialize, export_dwg, format_iges_line, has_texcoords, import_dwg, is_error, is_loaded, is_success, is_zero, orient_2d_interval, orient_2d_verified, plugin_license, plugin_name, read_ply, relative, snapping, unload, write_obj, write_ply
spatial 模块(5 个未测试)
get_aabb, get_position, index_of, query_ray_recursive, ray_hits_item, subdivide_recursive, update
collision 模块(4 个未测试)
gjk_distance, ray_aabb_intersect, sat_intersect, tri_aabb_overlap, tri_tri_intersect
sdf 模块(9 个未测试)
bend, chain_intersection, cheap_bend, displace, elongate, mirror_y, mirror_z, op_mirror_y, op_mirror_z, smooth_difference, smooth_intersection
sketch 模块(4 个未测试)
add_circle, count_equations, eval_constraint, fill_jacobian_rows
boolean 模块(1 个未测试)
clip_mesh
C API (capi/vde_capi.h)(15 个未测试)
vde_assembly_add_part, vde_assembly_free, vde_assembly_part_count, vde_body_free, vde_body_free_array, vde_body_load_iges, vde_body_load_step, vde_body_save_iges, vde_body_save_step, vde_collision_gjk_spheres, vde_collision_ray_mesh, vde_free_buffer, vde_mesh_get_bounds, vde_mesh_get_face, vde_mesh_get_vertex, vde_mesh_num_faces, vde_mesh_num_vertices, vde_save_mesh, vde_sdf_free, vde_serialize_mesh, vde_solver_add_vertical, vde_solver_get_point
第三部分:优先级排序
P0 严重(必须立即修复 — 核心功能完全不可用)
| 文件 | 函数 | 描述 |
|---|---|---|
src/curves/exact_offset.cpp |
exact_offset, offset_with_trimming |
精确偏移完全空壳,所有参数丢弃 |
src/brep/flexible_assembly.cpp |
create_flexible_assembly |
柔性装配完全空壳,3 个参数全部丢弃 |
src/brep/fastener_library.cpp |
create_bolt, create_nut, create_washer, create_threaded_hole |
紧固件库完全不可用,所有函数均返回错误形状 |
src/brep/defeature.cpp |
defeature, remove_fillets |
去特征完全空壳,CAE 前处理流程断裂 |
P1 重要(严重影响功能正确性)
| 文件 | 函数 | 描述 |
|---|---|---|
src/curves/iga_prep.cpp |
compute_bezier_extraction_1d |
Bézier 提取矩阵恒为单位矩阵 |
src/curves/iga_prep.cpp |
degree_elevation |
升阶完全未实现 |
src/curves/iga_prep.cpp |
bezier_extraction |
Bézier 提取恒为恒等变换 |
src/curves/iga_prep.cpp |
knot_insertion |
节点插入后未使用 refined 结果 |
src/mesh/mesh_quality.cpp |
evaluate_element_quality (Quad/Hex 分支) |
Quad/Hex 单元质量评估为空壳 |
| 176 个未测试函数中涉及核心几何计算的部分 | GDT 公差计算、碰撞检测、曲面连续性等 | 核心计算逻辑无测试覆盖,回归风险高 |
P2 次要(辅助功能无测试覆盖)
| 模块 | 函数数 | 示例 |
|---|---|---|
| brep/format_io | ~4 | 格式检测、文件头匹配等辅助函数 |
| foundation/utility | ~8 | cmp, relative, angular, is_zero 等数值工具 |
| core/platform | ~5 | cache_line_count, make_temp_file, delete_file 等 |
| C API | ~15 | 所有 C API wrapper 函数 |
第四部分:修复建议
立即行动(P0)
-
精确偏移:实现基于 NURBS 曲面法向偏移的核心算法(Piegl & Tiller 算法 A10.2),包括偏移距离控制和自交检测。
-
紧固件库:为螺栓(六角头 + 螺纹)、螺母(六角 + 内螺纹)、垫圈(环形)、螺纹孔实现准确的 B-Rep 形状。
- 参考标准:ISO 4014/4017 (螺栓), ISO 4032 (螺母), ISO 7089/7090 (垫圈)
-
去特征:实现面删除 + 周围面延伸填充的完整流程。参考学术论文 "Feature Suppression Based CAD Mesh Model Simplification" (2010)。
-
柔性装配:实现装配体弹性变形模拟,基于 FFD 变形 + 约束求解。
短期行动(P1)
-
IGA 准备流程:
- 实现 Piegl & Tiller 算法 A5.9 完成升阶
- 实现正确的节点插入(Boehm 算法)
- 实现 Bézier 提取矩阵计算
-
测试覆盖率提升:优先为 176 个未测试函数补充测试,从核心计算函数开始。
长期改进
- 建立 CI 覆盖率门禁(codecov),阻止未测试代码合入
- 引入
[[nodiscard]]标记关键函数防止结果丢弃 - 建立
// STUB:注释规范,统一追踪技术债
附录:扫描方法说明
- 空壳检测:
(void)param;模式 + 函数体过短(<~4 行有效代码)+ 参数全部丢弃 - 未测试检测:头文件公开函数声明集合 - 测试文件函数调用集合
- 工具:Python regex 扫描 + grep/ripgrep 多模式匹配
- 总计扫描:164 个 .cpp 源文件,186 个 .h 头文件,162 个测试文件