Removed (application layer, not kernel): - blender_addon/ — Blender plugin - dotnet/ — .NET/C# bindings - viewer/ — Web 3D viewer - include/vde/ai/ — AI/ML (GNN, generative design) - include/vde/cloud/ — Cloud-native (OT, sessions) - include/vde/distributed/ — Cluster computing - include/vde/kbe/ — Knowledge-based engineering - include/vde/wasm/ — WASM compilation - include/vde/digital_twin/ — Digital twin - include/vde/plugin/ — Plugin system - include/vde/gpu/ — GPU acceleration - src/ai/, src/cloud/, src/distributed/, src/kbe/, src/wasm/, src/digital_twin/, src/plugin/, src/gpu/ - tests/ai/, tests/cloud/, tests/distributed/, tests/kbe/, tests/gpu/ Kept (pure geometry kernel): - brep/ curves/ mesh/ core/ foundation/ spatial/ boolean/ collision/ sdf/ sketch/ capi/ - python/ bindings (kept as thin binding layer) Rationale: Parasolid/ACIS/CGM are pure kernels. AI, cloud, WASM, digital twin, Blender plugins, .NET bindings, and Web viewers belong in the application layer, not in the geometry engine. VDE should focus on being the best geometry kernel.
7.0 KiB
1|# ViewDesignEngine — 高性能 CAD 计算几何引擎
2|
3|C++17 全栈计算几何引擎。从底层数学工具到 B-Rep 拓扑建模、SDF 隐式建模、可微分几何、工业格式互操作,一条龙覆盖。
4|
5|
6|
7|
8|
9|
10|
11|## 快速开始
12|
13|### C++ 构建
14|
15|
bash 16|# Docker 构建环境(推荐) 17|docker exec vde-builder bash -c "cd /ws/ViewDesignEngine && cmake -B build && cmake --build build -j\$(nproc)" 18| 19|# 本地构建 20|cmake -B build -DCMAKE_BUILD_TYPE=Release 21|cmake --build build -j$(nproc) 22| 23|# 运行测试 24|cd build && ctest --output-on-failure 25| 26|# 运行示例 27|./build/examples/07_pipeline/pipeline_demo # SDF → GLB 全流程 28|
29|
30|依赖: CMake ≥ 3.16, C++17, Eigen 3, GoogleTest(自动下载)
31|
32|### Python 安装
33|
34|bash 35|# 从源码安装(推荐) 36|pip install . 37| 38|# 开发模式(可编辑安装) 39|pip install -e . 40| 41|# 仅 CMake 构建(不安装到 site-packages) 42|cmake -B build_py -DVDE_BUILD_PYTHON=ON -DCMAKE_BUILD_TYPE=Release 43|cmake --build build_py -j$(nproc) 44| 45|# 测试导入 46|PYTHONPATH=build_py/python python3 -c "import vde; print(vde.__version__)" 47|
48|
49|Python 依赖: CMake ≥ 3.16, C++17, Eigen 3(自动下载), pybind11 ≥ 2.10
50|
51|## 模块总览
52|
53|| 模块 | 命名空间 | 关键能力 |
54||------|---------|----------|
55|| foundation | vde::foundation | 数学类型、公差、精确谓词、STL/OBJ/PLY/GLTF(F/GLB) 读写 |
56|| core | vde::core | 多边形、Voronoi、凸包、ICP、距离计算 |
57|| curves | vde::curves | Bézier / B-Spline / NURBS 曲线曲面、自适应细分 |
58|| mesh | vde::mesh | 半边网格、Delaunay 2D/3D、QEM 简化、平滑、Marching Cubes、测地线、网格布尔 |
59|| spatial | vde::spatial | BVH (SAH)、Octree、KD-Tree、R-Tree (STR) |
60|| boolean | vde::boolean | 2D Sutherland-Hodgman、3D 网格布尔、多边形偏移 |
61|| collision | vde::collision | GJK/EPA、SAT、射线-三角形、三角交线 |
62|| brep | vde::brep | 边界表示 (B-Rep) 拓扑建模、布尔运算、验证 |
63|| sdf | vde::sdf | 15+ 隐式图元、CSG 树、自动微分、梯度优化、SDF → Mesh |
64|| sketch | vde::sketch | 2D 草图约束求解器 |
65|| capi | vde::capi | C API,跨语言互操作 |
67|
68|## 格式支持
69|
70|| 格式 | 导入 | 导出 | 说明 |
71||------|------|------|------|
72|| STEP (AP203/214) | ✅ | ✅ | 工业 CAD 交换标准 |
73|| IGES (5.3) | ✅ | ✅ | 传统制造业格式 |
74|| glTF 2.0 / GLB | — | ✅ | 实时 3D / Web 查看 |
75|| STL | — | ✅ | 3D 打印 |
76|| OBJ | — | ✅ | 通用网格 |
77|| PLY | — | ✅ | 点云/网格 |
78|
79|## 特色功能
80|
81|### 🔮 SDF 隐式建模
82|cpp 83|#include <vde/sdf/sdf_primitives.h> 84|#include <vde/sdf/sdf_operations.h> 85|#include <vde/sdf/sdf_tree.h> 86| 87|// 光滑并集 88|auto shape = SdfNode::smooth_union( 89| SdfNode::sphere(1.5), 90| SdfNode::box(Point3D(1, 1, 1)), 91| 0.3 92|); 93|double d = evaluate(shape, Point3D(0, 0, 0)); // SDF 值 94|
95|
96|### ⚡ 可微分几何 + torch 集成
97|cpp 98|#include <vde/sdf/sdf_gradient.h> 99|#include <vde/sdf/sdf_optimize.h> 100| 101|// 拟合 SDF 到点云 102|auto sphere = SdfNode::sphere(1.0); 103|auto result = fit_to_point_cloud(sphere, point_cloud, 0.01, 100); 104|// result.optimized_shape → 优化后的形状 105|
106|
107|### 🔧 B-Rep 工业建模
108|cpp 109|#include <vde/brep/modeling.h> 110|#include <vde/brep/brep_boolean.h> 111| 112|auto box = make_box(2, 2, 2); 113|auto shelled = shell(box, -1, 0.15); // 抽壳 114|auto filleted = fillet(box, 0, 0.3); // 倒圆 115|auto result = brep_union(a, b); // 布尔并 116|
117|
118|## 代码示例
119|
120|完整示例见 examples/:
121|- 01_hello_triangle — 基础几何
122|- 02_bezier — 曲线求值
123|- 03_mesh — 网格操作
124|- 04_delaunay — 三角剖分
125|- 05_boolean — 布尔运算
126|- 06_collision — 碰撞检测
127|- 07_pipeline — SDF → Mesh → GLB 完整管线
128|
129|## 测试
130|
131|| 类别 | 测试数 | 状态 |
132||------|--------|------|
133|| 核心 + 曲线 + 网格 + 空间 + 碰撞 | ~120 | ✅ |
134|| B-Rep 建模 + 验证 | ~70 | ✅ |
135|| STEP 导入/导出 | 31 | ✅ |
136|| IGES 导入/导出 | 39 | ✅ |
137|| SDF 隐式建模 | 189 | ✅ |
138|| 可微分几何 | 76 | ✅ |
139|| GLTF/GLB 导出 | 6 | ✅ |
140|| 草图约束 | — | ✅ |
141|| 合计 | ~476 | 100% |
142|
143|## 工程指标
144|
145|- 语言: C++17,零外部运行时依赖(仅 header-only Eigen + GTest)
146|- 测试: 500+ 用例,100% 通过
147|- 编译: GCC 11+ / Clang 16+,零错误零警告
148|- 格式支持: STEP、IGES、glTF/GLB、STL、OBJ、PLY
149|
150|## 文档
151|
153|- 开发计划 — 版本规划 + Sprint 划分
154|- v3.1 计划 — 下一阶段路线图
155|- CHANGELOG — 版本历史
156|- 构建指南
157|
158|## v6.0 新功能(计划中) 🔌
159|
161|
162|cpp 163|#include <vde/plugin/plugin_system.h> 164| 165|// 插件管理器:动态加载第三方扩展 166|vde::plugin::PluginManager mgr; 167|mgr.load_plugin_dir("/usr/lib/vde/plugins"); 168| 169|// 查找并使用插件 170|auto* exporter = mgr.get_plugin("io.export.gltf"); 171|exporter->execute("export", {{"path", "output.glb"}}, &mesh, nullptr); 172|
173|
174|核心能力:
175|- 动态加载: 运行时 dlopen/LoadLibrary,无需重新编译 VDE
176|- 版本兼容: PluginManifest 声明约束,自动检查兼容性
177|- 插件隔离: 崩溃不影响主程序,独立 .so/.dylib/.dll
178|- 注册宏: VDE_REGISTER_PLUGIN(MyPlugin) 一行注册
179|- 清单文件: plugin.json 加速发现和验证
180|
181|插件类型:
182|| 类型 | 说明 | 示例 |
183||------|------|------|
184|| IO_IMPORT | 格式导入器 | USDZ, FBX, 3DS |
185|| IO_EXPORT | 格式导出器 | USDZ, X3D, AMF |
186|| GEOMETRY_FILTER | 几何过滤器 | 平滑、简化、重网格 |
187|| CUSTOM_TOOL | 自定义工具 | 应力分析、拓扑优化 |
188|
190|
191|### 开发者生态
192|
193|- 📘 开发者指南 — 7 篇完整文档覆盖架构/API/构建/测试/贡献/插件
194|- 🏗️ 插件 SDK — 头文件 + CMake 模板 + 注册宏,5 分钟上手
195|- 🔒 安全分级 — L0 内置 → L1 签名 → L2 社区 → L3 沙箱
196|
197|## 许可证
198|
199|Apache License 2.0 — 详见 LICENSE
200|