Files
ViewDesignEngine/docs/reference/audit-untested.md
T

284 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ViewDesignEngine 全工程审计报告 — 无测试头文件分析
> **审计日期**: 2026-08-02
> **分支**: `audit/all-untested`
> **审计范围**: 85 个无直接测试覆盖的头文件(从186个头文件中筛选)
> **分类**: ❌空壳 / ⚠️部分实现 / ✅已实现
> **间接覆盖**: 由被 `#include` 到的其他测试间接验证
---
## 审计概览
| 指标 | 数量 |
|------|------|
| 总头文件 | 186 |
| 有直接测试 | 99 |
| 间接(include)覆盖 | 38 |
| 完全无测试 | 47 |
| **待审计(间接+无测试)** | **85** |
| ❌空壳(声明无实现) | 17 |
| ⚠️部分实现(实现不完整) | 9 |
| ✅已实现(有实现但无测试) | 59 |
---
## 一、按模块分类清单
> **注(2026-08 模块拆分后归属更新)**:审计快照按当时模块分类;下列头文件现已迁至独立模块目录:
> - `gizmo_api.h` / `viewport_api.h` → `include/vde_ui/`(命名空间 `vde::ui`)
> - `update_notifier.h` → `include/vde_event/`
> - `drawing_standards.h` / `layer_standards.h` → `include/vde_drafting/`
> - `concurrent_data.h` / `performance_tuning.h` → `include/vde_infra/`
> - `license_manager.h` → `include/vde_license/`
> - `platform.h` → `include/vde_platform/`
### 1.1 boolean 模块 (1)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `polygon_offset.h` | 0 | ✅已实现 (45行) | ❌无 | 无直接测试 |
### 1.2 brep 模块 (17)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `assembly_feature.h` | 1 | ✅已实现 (213行) | ⚠️ test_v5_features | 含装配特征构建逻辑 |
| `brep_position.h` | 2 | ✅已实现 (67行) | ❌无 | 位置/变换辅助 |
| `constraint_types.h` | 0 | ❌空壳 | ❌无 | 仅类型别名定义 |
| `defeature.h` | 4 | ⚠️部分实现 (29行) | ⚠️ test_feature_recognition | 去特征功能骨架 |
| `dimension_api.h` | 0 | ✅已实现 (106行) | ❌无 | 尺寸标注 API |
| `drawing_standards.h` | 59 | ✅已实现 (786行) | ⚠️ test_constraint_solver_3d | 工程图标准库(大文件) |
| `dxf_import.h` | 3 | ✅已实现 (412行) | ⚠️ test_brep_drawing | DXF导入,有间接验证 |
| `fastener_library.h` | 4 | ⚠️部分实现 (16行) | ⚠️ test_v5_1 | 紧固件库(仅骨架) |
| `feature_tree.h` | 9 | ✅已实现 (148行) | ⚠️ 3个测试引用 | 特征树结构 |
| `flexible_assembly.h` | 1 | ⚠️部分实现 (9行) | ⚠️ test_v5_1 | 柔性装配(仅骨架) |
| `format_io.h` | 3 | ✅已实现 (152行) | ⚠️ test_v4_1 | 格式I/O路由 |
| `geometric_snap.h` | 2 | ✅已实现 (230行) | ❌无 | 几何捕捉功能 |
| `gizmo_api.h` | 0 | ✅已实现 (156行) | ❌无 | Gizmo操作API |
| `hlr_api.h` | 0 | ✅已实现 (407行) | ❌无 | 隐藏线消除API |
| `large_assembly.h` | 11 | ✅已实现 (125行) | ⚠️ test_v4_1 | 大型装配优化 |
| `layer_standards.h` | 6 | ❌空壳 | ❌无 | 图层标准(仅声明) |
| `modeling.h` | 9 | ✅已实现 (1152行) | ✅ 76个测试引用 | 核心建模API(被广泛间接覆盖) |
| `pattern_ops.h` | 0 | ✅已实现 (152行) | ❌无 | 阵列/镜像操作 |
| `pmi_types.h` | 0 | ❌空壳 | ⚠️ test_step_ap242 | PMI类型定义(仅声明) |
| `section_view.h` | 0 | ✅已实现 (341行) | ❌无 | 剖面视图功能 |
| `structural_profiles.h` | 0 | ✅已实现 (224行) | ❌无 | 结构型材库 |
| `update_notifier.h` | 4 | ❌空壳 | ❌无 | 更新通知(仅声明) |
| `viewport_api.h` | 4 | ✅已实现 (192行) | ❌无 | 视口API |
### 1.3 capi 模块 (1)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `vde_capi.h` | 60+ | ✅已实现 (316行) | ❌无 | **C语言API接口**(60+ 个函数,重要!)|
### 1.4 collision 模块 (3)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `ray_intersect.h` | 0 | ✅已实现 (94行) | ⚠️ test_ray | 射线求交 |
| `sat.h` | 0 | ✅已实现 (48行) | ❌无 | SAT碰撞检测 |
| `tri_intersect.h` | 2 | ✅已实现 (157行) | ❌无 | 三角形求交 |
### 1.5 core 模块 (11)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `aabb.h` | 2 | ❌空壳 | ⚠️ 5个测试引用 | AABB包围盒(仅头文件声明) |
| `concurrent_data.h` | 31 | ⚠️部分实现 (22行) | ⚠️ test_concurrent | 并发数据结构 |
| `icp.h` | 0 | ✅已实现 (74行) | ❌无 | ICP点云配准 |
| `license_manager.h` | 32 | ✅已实现 (454行) | ⚠️ test_license | 许可证管理 |
| `line.h` | 1 | ❌空壳 | ⚠️ test_distance | Line几何(仅声明) |
| `performance_tuning.h` | 57 | ✅已实现 (591行) | ⚠️ test_performance | 性能调优 |
| `plane.h` | 2 | ❌空壳 | ⚠️ 3个测试引用 | Plane几何(仅声明) |
| `platform.h` | 6 | ✅已实现 (97行) | ❌无 | 平台抽象层 |
| `simd_vector.h` | 8 | ❌空壳 | ❌无 | SIMD向量(仅声明) |
| `topology_compression.h` | 4 | ✅已实现 (254行) | ❌无 | 拓扑压缩 |
| `triangle.h` | 1 | ❌空壳 | ⚠️ 2个测试引用 | Triangle几何(仅声明) |
| `voronoi.h` | 0 | ✅已实现 (51行) | ❌无 | Voronoi图 |
### 1.6 curves 模块 (15)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `bezier_curve.h` | 7 | ✅已实现 (68行) | ⚠️ test_bezier | Bézier曲线 |
| `bezier_surface.h` | 11 | ✅已实现 (82行) | ❌无 | Bézier曲面 |
| `bspline_curve.h` | 7 | ✅已实现 (103行) | ❌无 | B样条曲线基础 |
| `bspline_surface.h` | 9 | ✅已实现 (82行) | ❌无 | B样条曲面基础 |
| `continuity_types.h` | 0 | ❌空壳 | ⚠️ test_surface_battery | 连续性类型定义 |
| `control_point_edit.h` | 0 | ✅已实现 (88行) | ⚠️ test_surface_editing | 控制点编辑 |
| `curve_surface_projection.h` | 0 | ✅已实现 (263行) | ❌无 | 曲线-曲面投影 |
| `exact_offset.h` | 1 | ⚠️部分实现 (5行) | ⚠️ test_v5_features | 精确等距(骨架) |
| `nurbs_curve.h` | 8 | ✅已实现 (160行) | ✅ 18个测试引用 | NURBS曲线(广泛间接覆盖) |
| `nurbs_surface.h` | 16 | ✅已实现 (186行) | ✅ 24个测试引用 | NURBS曲面(广泛间接覆盖) |
| `surface_fairing.h` | 0 | ✅已实现 (450行) | ⚠️ test_v5_features | 曲面光顺 |
| `surface_tools.h` | 0 | ✅已实现 (239行) | ⚠️ 2个测试引用 | 曲面工具集 |
| `tessellation.h` | 0 | ✅已实现 (115行) | ❌无 | 曲面离散化 |
### 1.7 foundation 模块 (15)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `error_codes.h` | 2 | ✅已实现 (175行) | ❌无 | 错误码系统 |
| `exact_predicates_gmp.h` | 0 | ⚠️部分实现 (4行) | ❌无 | GMP精确谓词(骨架) |
| `format_utils.h` | 0 | ❌空壳 | ❌无 | 格式工具(仅声明) |
| `interval.h` | 1 | ❌空壳 | ❌无 | 区间运算(仅声明) |
| `io_dwg_plugin.h` | 13 | ✅已实现 (48行) | ❌无 | DWG插件接口 |
| `io_dxf.h` | 4 | ✅已实现 (819行) | ⚠️ test_dxf, test_all_formats | DXF输入输出 |
| `io_obj.h` | 2 | ✅已实现 (114行) | ⚠️ test_all_formats | OBJ格式 |
| `io_ply.h` | 2 | ✅已实现 (96行) | ⚠️ test_all_formats | PLY格式 |
| `io_stl.h` | 4 | ✅已实现 (132行) | ⚠️ test_all_formats | STL格式 |
| `math_types.h` | 0 | ❌空壳 | ❌无 | 数学类型(仅声明) |
| `memory_pool.h` | 3 | ❌空壳 | ❌无 | 内存池(仅声明) |
| `predicates.h` | 0 | ❌空壳 | ❌无 | 几何谓词(仅声明) |
| `serializer.h` | 7 | ✅已实现 (84行) | ❌无 | 序列化器 |
### 1.8 mesh 模块 (13)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `alpha_shapes.h` | 1 | ✅已实现 (70行) | ❌无 | Alpha形状 |
| `cdt_2d.h` | 0 | ✅已实现 (112行) | ❌无 | 约束Delaunay三角化2D |
| `delaunay_2d.h` | 1 | ✅已实现 (108行) | ⚠️ test_delaunay | Delaunay三角化2D |
| `geodesic.h` | 0 | ✅已实现 (145行) | ❌无 | 测地线距离 |
| `halfedge_mesh.h` | 27 | ✅已实现 (109行) | ✅ 14个测试引用 | 半边网格(核心数据结构) |
| `marching_cubes.h` | 0 | ✅已实现 (142行) | ❌无 | Marching Cubes |
| `mesh_boolean.h` | 1 | ✅已实现 (400行) | ❌无 | 网格布尔运算 |
| `mesh_curvature.h` | 1 | ✅已实现 (78行) | ❌无 | 网格曲率 |
| `mesh_parameterize.h` | 0 | ✅已实现 (59行) | ❌无 | 网格参数化 |
| `mesh_quality.h` | 6 | ✅已实现 (323行) | ⚠️ test_fea_mesh, test_quality | 网格质量评估 |
| `mesh_repair.h` | 1 | ✅已实现 (59行) | ⚠️ test_mesh_robustness | 网格修复 |
| `mesh_simplify.h` | 1 | ✅已实现 (197行) | ❌无 | 网格简化 |
| `mesh_smooth.h` | 5 | ✅已实现 (186行) | ⚠️ test_smooth | 网格平滑 |
| `visualization_quality.h` | 2 | ✅已实现 (235行) | ⚠️ test_visualization | 可视化质量 |
### 1.9 sdf 模块 (1)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `sdf_torch.h` | 0 | ✅已实现 (39行) | ⚠️ test_sdf_torch_bridge | PyTorch桥接 |
### 1.10 spatial 模块 (4)
| 文件 | 函数数 | 实现状态 | 间接覆盖 | 备注 |
|------|--------|----------|----------|------|
| `incremental_bvh.h` | 12 | ✅已实现 (89行) | ❌无 | 增量BVH |
| `kd_tree.h` | 16 | ✅已实现 (261行) | ❌无 | KD树 |
| `octree.h` | 22 | ✅已实现 (271行) | ❌无 | 八叉树 |
| `spatial_index.h` | 0 | ❌空壳 | ❌无 | 空间索引基类(仅声明) |
---
## 二、实现质量分类统计
### ❌ 空壳 (17个) — 只有声明无实现
`constraint_types`, `pmi_types`, `layer_standards`, `update_notifier`, `aabb`, `line`, `plane`, `triangle`,
`simd_vector`, `continuity_types`, `format_utils`, `interval`, `math_types`, `memory_pool`, `predicates`,
`spatial_index`, `exact_predicates_gmp`
### ⚠️ 部分实现 (9个) — 有实现但不完整
`defeature`, `fastener_library`, `flexible_assembly`, `concurrent_data`, `exact_offset`,
`exact_predicates_gmp`, `mesh_repair`, `mesh_parameterize`, `sdf_torch`
### ✅ 已实现但无测试 (59个) — 核心问题
---
## 三、测试优先级排序(针对"已实现但无测试"的59个)
### P0 — 立即修复 (用户可见核心功能)
| 优先级 | 文件 | 函数数 | 理由 |
|--------|------|--------|------|
| **P0** | `vde_capi.h` | 49 | C API 接口,外部语言绑定的唯一入口 |
| **P0** | `io_gltf.h` (已修复bug) | ⚡ | glTF导入导出(已修复componentType bug) |
| **P0** | `viewport_api.h` | 4 | 视口API,直接影响渲染/交互 |
| **P0** | `mesh_boolean.h` | 1 | 网格布尔运算,核心建模功能 |
| **P0** | `brep_position.h` | 2 | B-Rep位置变换,所有模型操作基础 |
| **P0** | `kd_tree.h` | 16 | KD树空间查询,碰撞/拾取基础 |
| **P0** | `marching_cubes.h` | 0 | Marching Cubes等值面提取 |
| **P0** | `cdt_2d.h` | 0 | 约束Delaunay三角化 |
### P1 — 本周完成 (重要但非关键)
| 优先级 | 文件 | 函数数 | 理由 |
|--------|------|--------|------|
| P1 | `bezier_surface.h` | 11 | Bézier曲面实现 |
| P1 | `bspline_curve.h` | 7 | B样条曲线(NURBS基础) |
| P1 | `bspline_surface.h` | 9 | B样条曲面(NURBS基础) |
| P1 | `octree.h` | 22 | 八叉树空间索引 |
| P1 | `incremental_bvh.h` | 12 | 增量BVH加速结构 |
| P1 | `hlr_api.h` | 0 | 隐藏线消除 |
| P1 | `mesh_simplify.h` | 1 | 网格简化 |
| P1 | `mesh_curvature.h` | 1 | 网格曲率 |
| P1 | `geodesic.h` | 0 | 测地线距离 |
| P1 | `tri_intersect.h` | 2 | 三角形求交 |
### P2 — 本月完成 (辅助/工具类功能)
| 优先级 | 文件 | 函数数 | 理由 |
|--------|------|--------|------|
| P2 | `error_codes.h` | 2 | 错误码系统 |
| P2 | `platform.h` | 6 | 平台抽象层 |
| P2 | `serializer.h` | 7 | 序列化 |
| P2 | `topology_compression.h` | 4 | 拓扑压缩 |
| P2 | `io_obj.h`, `io_ply.h`, `io_stl.h` | 2+2+4 | 简单网格格式(有间接覆盖) |
| P2 | 其余所有未列出的 | - | 辅助功能 |
---
## 四、Bug修复记录
### 4.1 glTF import: componentType 字节偏移 bug ✅已修复
**文件**: `src/foundation/io_gltf.cpp`
**问题**: `build_mesh_from_accessors()` 中直接使用硬编码值(`12 * i`, `4 : 2`)计算顶点和索引数据的字节偏移,未根据 `componentType` 和 `type` 正确计算每个元素的实际字节大小。例如:
- 顶点数据始终假设为 `FLOAT VEC3` (=12字节),不支持其他 glTF 类型
- 索引数据仅处理 `UNSIGNED_INT` 和 `UNSIGNED_SHORT`,不支持 `UNSIGNED_BYTE`
- 缺少越界保护
**修复**:
1. 新增 `component_type_byte_size()` 函数,按 glTF 2.0 规范正确映射 componentType → 字节大小
2. 新增 `type_num_components()` 函数,按 glTF 类型 (SCALAR/VEC2/VEC3/VEC4/MATx) 返回分量数
3. 使用计算出的 stride 替代硬编码值
4. 添加索引 `UNSIGNED_BYTE` 类型支持
5. 添加越界保护
### 4.2 COLLADA import: 空曲面崩溃 ✅已修复
**文件**:
- `src/mesh/brep_to_mesh.cpp`
- `src/foundation/io_collada.cpp`
- `include/vde/curves/nurbs_surface.h`
**问题**:
1. `brep_to_mesh.cpp` 的 `to_mesh()` 中对 `surfaces_[face.surface_id]` 调用 `tessellate()` 时,若曲面为空或退化则崩溃
2. `io_collada.cpp` 的 `import_collada()` 中创建退化NURBS曲面后直接传给 `add_surface()`
**修复**:
1. `nurbs_surface.h`: 新增 `is_degenerate()` 方法检测空/退化曲面
2. `brep_to_mesh.cpp`: 在 `tessellate()` 调用前检查 `surf.is_degenerate()`
3. `io_collada.cpp`: 在 `add_surface()` 调用前跳过退化曲面
---
## 五、P0 测试蓝图
以下为 P0 级模块生成的测试文件概要:
| 测试文件 | 目标头文件 | 测试用例数 |
|---------|-----------|-----------|
| `tests/capi/test_vde_capi.cpp` | vde_capi.h | ≥3 |
| `tests/core/test_viewport_api.cpp` | viewport_api.h | ≥3 |
| `tests/mesh/test_mesh_boolean.cpp` | mesh_boolean.h | ≥3 |
| `tests/brep/test_brep_position.cpp` | brep_position.h | ≥3 |
| `tests/spatial/test_kd_tree.cpp` | kd_tree.h | ≥3 |
| `tests/mesh/test_marching_cubes.cpp` | marching_cubes.h | ≥3 |
| `tests/mesh/test_cdt_2d.cpp` | cdt_2d.h | ≥3 |
---
*报告结束 — 由 Hermes Agent 自动生成*