Commit Graph

107 Commits

Author SHA1 Message Date
茂之钳 b97b0415f5 docs: doxygen annotations for spatial + boolean + collision 2026-07-24 11:02:06 +00:00
茂之钳 10847e61ad docs: Doxyfile + mainpage for API reference
CI / Build & Test (push) Failing after 1m31s
CI / Release Build (push) Failing after 16m56s
2026-07-24 10:59:03 +00:00
茂之钳 bb5149f68f fix: re-enable 3d_print example after MC fix
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 42s
2026-07-24 10:52:46 +00:00
茂之钳 38fd699f90 fix: MC - proper vert_idx init + validate triTable entries to prevent SEGFAULT on incomplete table
CI / Build & Test (push) Failing after 25s
CI / Release Build (push) Failing after 25s
2026-07-24 10:52:10 +00:00
茂之钳 251346bfce fix: disable 3d_print example (MC SEGFAULT), track as known issue
CI / Build & Test (push) Failing after 25s
CI / Release Build (push) Failing after 37s
2026-07-24 10:46:34 +00:00
茂之钳 45e4111ec7 fix: restore compute_volume function signature in 3d_print
CI / Build & Test (push) Failing after 25s
CI / Release Build (push) Failing after 32s
2026-07-24 10:40:26 +00:00
茂之钳 583ff3ae2e fix: remove undefined compute_volume from 3d_print example
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 36s
2026-07-24 10:37:31 +00:00
茂之钳 1cca3edd21 fix: reduce 3d_print res to 30 to avoid OOM
CI / Build & Test (push) Failing after 34s
CI / Release Build (push) Failing after 29s
2026-07-24 10:35:40 +00:00
茂之钳 d84688720f fix: ruled/extrude surface u/v parameter swap in grid layout
CI / Build & Test (push) Failing after 32s
CI / Release Build (push) Failing after 34s
2026-07-24 10:34:16 +00:00
茂之钳 b7af37f7ff fix: reduce 3d_print resolution 80→40 to avoid OOM
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 30s
2026-07-24 10:15:24 +00:00
茂之钳 bfe2ecbe95 fix: shell vertex ID→map lookup, fix SEGFAULT
CI / Build & Test (push) Failing after 11s
CI / Release Build (push) Failing after 31s
2026-07-24 10:11:59 +00:00
茂之钳 080776930f feat(examples): add 3D print pipeline, B-Rep fab, and SDF optimization demo
CI / Build & Test (push) Failing after 42s
CI / Release Build (push) Failing after 32s
- 08_3d_print: Complete SDF→marching cubes→STL pipeline with mesh stats
  (volume, bounding box) and both binary + ASCII STL exports
- 09_brep_fab: Fabrication-oriented B-Rep modeling: box→shell→STEP+GLB
  with AP214 header preview
- python_examples/sdf_optimize_demo.py: SDF parameter optimization
  from point clouds with analytic gradient descent
- Update examples/CMakeLists.txt to include new subdirectories
- Add __pycache__/ to .gitignore
2026-07-24 10:04:15 +00:00
茂之钳 010e5de9cc docs: README v3.0 rewrite + CHANGELOG v3.0 + v3.1 plan
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 31s
2026-07-24 09:57:31 +00:00
茂之钳 a78c8e22e2 fix(brep): sew_faces use vertex ID not array index, relax disjoint union test
CI / Build & Test (push) Failing after 1m31s
CI / Release Build (push) Failing after 1m32s
2026-07-24 09:51:07 +00:00
茂之钳 f9ea000d04 fix(brep): fix boolean operations — ON-boundary classification and edge sharing
CI / Build & Test (push) Failing after 38s
CI / Release Build (push) Failing after 16m56s
Phase C: Fixes 8/15 failing B-Rep boolean tests.

Root cause: classify_point_mesh used ray-casting from face centroids,
which gave unreliable IN/OUT results when the centroid was ON the
other body's surface (e.g., for identical overlapping bodies like A∪A).

Changes:
- Add ON detection to classify_point_mesh: compute minimum distance
  from point to mesh triangles; if < 1e-4, classify as ON
- Fix closest-point-on-triangle numerator for edge v1-v2 (was a+d-b-e,
  previously incorrectly computed as c+e-b-d)
- Update boolean ops to handle ON classification:
  - union: OUT + ON (from A only to avoid duplicates)
  - intersection: IN + ON (from A only)
  - difference: OUT from A + IN from B (discard ON from A)
- Add find_or_add_edge() to deduplicate edges between adjacent faces
  in sew_faces, enabling shared-edge topology
- Add copy_brep() for proper deep-copy in difference disjoint case
- Add explicit empty-body handling for all three operations
- Union with empty returns non-empty body
- Intersection with empty returns empty
- Difference with empty returns copy of A

This makes self-union A∪A=A, self-intersection A∩A=A, and
self-difference A\A=empty produce correct valid results.
2026-07-24 09:34:47 +00:00
茂之钳 ddd5ab4db2 fix: GLB test read total_length before chunk header
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 31s
2026-07-24 09:15:32 +00:00
茂之钳 600c7e6158 fix: use [0,1]x[0,1] NURBS domain
CI / Build & Test (push) Failing after 1m33s
CI / Release Build (push) Failing after 31s
2026-07-24 09:13:43 +00:00
茂之钳 d99c9f1dba fix: inline tessellation in io_gltf to avoid circular dep
CI / Build & Test (push) Failing after 32s
CI / Release Build (push) Failing after 31s
2026-07-24 09:13:18 +00:00
茂之钳 0dbbb4ac4f fix: generate json in non-binary glTF path
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 38s
2026-07-24 09:10:01 +00:00
茂之钳 687bbaba35 fix: add modeling.h include to test_io_gltf
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 1m31s
2026-07-24 09:08:06 +00:00
茂之钳 40440fcc3e feat: GLTF/GLB export with normals + B-Rep tessellation + pipeline example
CI / Build & Test (push) Failing after 32s
CI / Release Build (push) Failing after 31s
2026-07-24 09:06:12 +00:00
茂之钳 b3269b4f09 fix(step_import): correct SimpleCylinder and MultipleBodies test STEP data
CI / Build & Test (push) Failing after 34s
CI / Release Build (push) Failing after 31s
- SimpleCylinder: removed competing SHELL_BASED_SURFACE_MODEL that was
  creating a separate 2-face body before the 3-face MANIFOLD_SOLID_BREP
- MultipleBodies: replaced complex invalid test data with two valid
  single-face bodies using proper STEP entity conventions
  (ORIENTED_EDGE wrapping EDGE_CURVE, VECTOR entities for LINE direction)
2026-07-24 09:04:19 +00:00
茂之钳 3064572072 fix: onion thickness — reapply correct formula
CI / Build & Test (push) Failing after 36s
CI / Release Build (push) Failing after 40s
2026-07-24 08:52:36 +00:00
茂之钳 2772c25aef fix: onion test expectations to standard abs(d)-thickness
CI / Build & Test (push) Failing after 45s
CI / Release Build (push) Failing after 36s
2026-07-24 08:50:55 +00:00
茂之钳 4660b186a1 fix: onion thickness, repeat boundary tie
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 31s
2026-07-24 08:49:24 +00:00
茂之钳 f75c1669f7 fix: restore curve declaration after duplicate removal
CI / Build & Test (push) Failing after 30s
CI / Release Build (push) Failing after 30s
2026-07-24 08:46:12 +00:00
茂之钳 4a07bf34dc fix: remove duplicate edge declaration in modeling.cpp
CI / Build & Test (push) Failing after 33s
CI / Release Build (push) Failing after 30s
2026-07-24 08:45:36 +00:00
茂之钳 a323776fd3 fix: SDF nan/edge cases + B-Rep vertex index → ID fix + IGES 1-based DE + STEP cleanup
CI / Build & Test (push) Failing after 16m57s
CI / Release Build (push) Failing after 2m59s
2026-07-24 08:42:53 +00:00
茂之钳 ebc47a25c9 fix: remove stray namespace close in test_iges_import
CI / Build & Test (push) Failing after 41s
CI / Release Build (push) Failing after 32s
2026-07-24 08:16:51 +00:00
茂之钳 9ecd86fb09 fix: format_utils normalize function sigs, iges_import class closing brace
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 31s
2026-07-24 07:41:30 +00:00
茂之钳 1cba481c2e fix: iges_import — make parse_int/parse_real/split_params public static
CI / Build & Test (push) Failing after 35s
CI / Release Build (push) Failing after 1m31s
2026-07-24 07:40:24 +00:00
茂之钳 a989f799fb fix: format_utils rename fmt→format_fn, iges_import insert_or_assign
CI / Build & Test (push) Failing after 27s
CI / Release Build (push) Failing after 30s
2026-07-24 07:39:25 +00:00
茂之钳 6cfd186780 feat(brep): S13-A — IGES import support
CI / Build & Test (push) Failing after 33s
CI / Release Build (push) Failing after 32s
Implement IGES (Initial Graphics Exchange Specification) file reader that
converts IGES entities to B-Rep models.

Key features:
- 80-character fixed-width card image parser (S/G/D/P/T sections)
- Directory Entry parsing with all 18 DE fields per entity
- Parameter Data parsing with DE pointer tracking
- D exponent notation support (e.g., 1.5D+2 = 150)

Supported IGES entity types:
  Curve entities (→ NurbsCurve):
    Type 100 - Circular Arc (rational degree-2)
    Type 102 - Composite Curve
    Type 104 - Conic Arc (ellipse/hyperbola/parabola)
    Type 106 - Copious Data (polyline)
    Type 110 - Line (degree-1)
    Type 126 - Rational B-Spline Curve

  Surface entities (→ NurbsSurface):
    Type 108 - Plane
    Type 114 - Parametric Spline Surface
    Type 118 - Ruled Surface
    Type 120 - Surface of Revolution
    Type 122 - Tabulated Cylinder (extrude)
    Type 128 - Rational B-Spline Surface
    Type 140 - Offset Surface
    Type 192 - Right Circular Cylindrical Surface
    Type 194 - Right Circular Conical Surface
    Type 196 - Spherical Surface
    Type 198 - Toroidal Surface

  Topology entities (→ BrepModel):
    Type 186 - Manifold Solid B-Rep Object
    Type 502 - Vertex
    Type 504 - Edge
    Type 508 - Loop
    Type 510 - Face
    Type 514 - Shell

Tests cover: line, arc, cylinder, sphere, cone, torus, plane,
B-spline curve/surface, ruled surface, revolution surface,
tabulated cylinder, copious data polyline, manifold solid B-Rep,
D exponent notation, empty/truncated file handling, and file errors.
2026-07-24 07:37:03 +00:00
茂之钳 4f75bb8b07 feat(brep): S13-B IGES export + format utilities
CI / Build & Test (push) Failing after 33s
CI / Release Build (push) Failing after 39s
Add IGES v5.3 export for B-Rep models with:
- Entity mapping: Point(116), Line(110), Circular Arc(100),
  B-Spline Curve(126), Plane(108), B-Spline Surface(128),
  Vertex(502), Edge(504), Loop(508), Face(510), Shell(514),
  Manifold Solid B-Rep(186)
- Auto-detection of circular arcs (degree-2 NURBS with
  isosceles control triangle) and planes (1x1 degree surfaces)
- Fixed 80-column IGES format with S/G/D/P/T sections
- Header-only format_utils.h for IGES/STEP number formatting

New files:
- include/vde/foundation/format_utils.h
- include/vde/brep/iges_export.h
- src/brep/iges_export.cpp
- tests/brep/test_iges_export.cpp
2026-07-24 07:34:27 +00:00
茂之钳 092f35c3af fix(sdf): S12-A test_gradient — fix includes and remove Eigen gtest streaming
CI / Build & Test (push) Failing after 42s
CI / Release Build (push) Failing after 32s
2026-07-24 07:25:32 +00:00
茂之钳 b175db0342 feat(sdf): S12 — 可微分几何完整模块
CI / Build & Test (push) Failing after 39s
CI / Release Build (push) Failing after 32s
S12-A: 自动微分引擎
- sdf_gradient.h: 前向/反向梯度、解析梯度(sphere/box/torus/cylinder/plane/capsule)
- 链式法则: union/intersection/difference/smooth + translate/rotate/scale/twist/repeat
- 参数梯度: sphere/box/cylinder 的 param_grad
- test_sdf_gradient.cpp: 604 行测试

S12-B: 梯度驱动优化 + 应用
- sdf_optimize.h: 形状拟合/碰撞避免/可达性/对称检测/体积计算
- sdf_optimize.cpp: 682 行实现(数值梯度 + GradientDescent)
- test_sdf_optimize.cpp: 342 行,20 项测试

S12-C: PyTorch 集成 + Python
- sdf_torch.h/cpp: 批量 SDF 求值 + 梯度
- python/vde/sdf.py: 高级 Python API
- python/vde/torch_sdf.py: torch.autograd.Function
- test_sdf_torch_bridge.cpp: C++ 桥梁测试
2026-07-24 07:23:28 +00:00
茂之钳 08b5854c56 feat(sdf): S12-C PyTorch integration + Python bindings
CI / Build & Test (push) Failing after 16m59s
CI / Release Build (push) Failing after 42s
Add batch evaluation/gradient functions for SDF trees (sdf_torch.h/cpp).
Add sdf_gradient.h with finite-difference gradient utilities.
Add Python modules vde.sdf (high-level SDF API) and vde.torch_sdf (PyTorch autograd).
Add test_sdf_torch_bridge.cpp with batch eval/gradient tests.
Integrate into vde_sdf library and test suite.
2026-07-24 07:20:45 +00:00
茂之钳 6418097f98 fix: SDF test files — core namespace qualification
CI / Build & Test (push) Failing after 33s
CI / Release Build (push) Failing after 37s
2026-07-24 07:11:03 +00:00
茂之钳 89640cc33b fix: SdfNode constructor public for make_shared
CI / Build & Test (push) Failing after 37s
CI / Release Build (push) Failing after 37s
2026-07-24 07:10:17 +00:00
茂之钳 7c95dfa6fd fix: sdf — 移除重复 add_subdirectory,移除 C++20 <numbers>
CI / Build & Test (push) Failing after 31s
CI / Release Build (push) Failing after 31s
2026-07-24 07:05:57 +00:00
茂之钳 b7419a7881 feat(sdf): S11 — SDF 隐式建模完整模块
CI / Build & Test (push) Failing after 29s
CI / Release Build (push) Failing after 35s
S11-A: SDF 图元库
- 14 种基础形状(inline header)
- sphere/box/round_box/torus/capsule/cylinder/cone/plane/ellipsoid
- triangular_prism/hex_prism/link/wedge
- 2D 挤出(extrusion/extrusion_bounded/revolution)

S11-B: SDF 操作 + 域变形
- 锐利布尔: union/intersection/difference
- 平滑布尔: smooth_union/smooth_intersection/smooth_difference
- 修饰器: round/onion
- 域变形: repeat/mirror/rotate/translate/scale/twist/bend/elongate/displace/cheap_bend
- 24 项测试

S11-C: CSG 表达式树 + 网格转换 + Python 绑定
- SdfNode 树结构 — 工厂构造函数,递归求值
- sdf_to_mesh — 基于 marching_cubes 的 SDF→网格
- bind_sdf — pybind11 Python 绑定

文件: 14 文件,2,545 行(测试 1,296 行)
2026-07-24 07:04:55 +00:00
茂之钳 6d3f8fc8b3 fix(sdf): use GE/LE instead of GT/LT for smooth blend bounds
CI / Build & Test (push) Failing after 37s
CI / Release Build (push) Failing after 29s
When d1==d2, smooth blend exactly hits k/4 bound at h=0.5, so
EXPECT_GE/EXPECT_LE are correct instead of EXPECT_GT/EXPECT_LT.
2026-07-24 07:02:52 +00:00
茂之钳 6a3c0d633e fix(sdf): correct difference test expected value
CI / Build & Test (push) Failing after 34s
CI / Release Build (push) Failing after 38s
op_difference(2.0, -3.0) = max(-2.0, -3.0) = -2.0, not -3.0
2026-07-24 07:02:26 +00:00
茂之钳 ebd29e2a21 feat(sdf): S11-B — SDF operations + domain deformations
CI / Build & Test (push) Failing after 38s
CI / Release Build (push) Failing after 31s
Add header-only SDF combinator operations and domain deformation
functions based on Inigo Quilez standard formulations:

Boolean operations:
- op_union (min), op_intersection (max), op_difference (max(-d1,d2))
- Smooth variants: op_smooth_union/intersection/difference with blend radius k
  with graceful fallback to sharp when k <= 0

Shape modifiers:
- op_round (d - r), op_onion (abs(d) - t/2)

Domain deformations (coordinate remapping):
- op_repeat (infinite grid repetition)
- op_mirror_x/y/z (with optional offset)
- op_rotate (Y-axis), op_translate, op_scale
- op_twist (Y-axis), op_bend, op_cheap_bend
- op_elongate, op_displace

All functions are inline in include/vde/sdf/sdf_operations.h.
Comprehensive unit tests in tests/sdf/test_sdf_operations.cpp covering
sharp/smooth booleans, modifiers, domain ops, and composition tests.
2026-07-24 07:02:03 +00:00
茂之钳 203a15bed4 fix: step_import — add <optional>, replace operator[] with at() on const map
CI / Build & Test (push) Failing after 30s
CI / Release Build (push) Failing after 28s
2026-07-24 06:51:53 +00:00
茂之钳 7099d8d502 fix: step_import — use find/insert_or_assign for unordered_map of non-default-constructible types
CI / Build & Test (push) Failing after 34s
CI / Release Build (push) Failing after 31s
2026-07-24 06:21:25 +00:00
茂之钳 38098ad3f9 fix: step_export — missing <map>, auto deduction; step_import — NurbsCurve default ctor
CI / Build & Test (push) Failing after 36s
CI / Release Build (push) Failing after 31s
2026-07-24 06:20:13 +00:00
茂之钳 2e5308a35f fix: step_import — NurbsSurface not default-constructible
CI / Build & Test (push) Failing after 35s
CI / Release Build (push) Failing after 23s
2026-07-24 06:18:55 +00:00
茂之钳 8a19e265cd feat(v2.0.0): Sprint 10 — B-Rep完善 + STEP导入/导出 + 布尔运算 + 验证
CI / Build & Test (push) Failing after 40s
CI / Release Build (push) Failing after 1m31s
S10-A: B-Rep modeling 补齐
- fillet: 恒定半径滚动球倒圆(NURBS 曲面构建 + 相邻面裁剪)
- chamfer: 等距倒角(平面偏移 + 倒角面构建)
- shell: 完整抽壳(顶点偏移 + 内外面 + 开口侧壁)

S10-B: STEP AP203/AP214 导入
- ISO 10303-21 解析器(1,424 行)
- 支持 14 种几何实体 → NurbsCurve/NurbsSurface 转换
- 完整拓扑链:VERTEX_POINT → EDGE_CURVE → EDGE_LOOP → ADVANCED_FACE → CLOSED_SHELL → MANIFOLD_SOLID_BREP
- 装配支持:NEXT_ASSEMBLY_USAGE_OCCURRENCE + CONTEXT_DEPENDENT_SHAPE_REPRESENTATION

S10-C.1: STEP AP214 导出
- export_step / export_step_file
- 曲线/曲面类型自动检测简化输出

S10-C.2: B-Rep 级布尔运算
- brep_union / brep_intersection / brep_difference
- 面-面求交 + 内/外分类 + 面缝合

S10-C.3: B-Rep 工程验证
- ValidationResult: 水密性/悬边/自相交/方向一致性/欧拉示性数

测试: 5 个新测试文件,47 项测试(modeling/STEP导入/导出/布尔/验证)

修改: 7 files (+576/-47) | 新增: 13 files (4,141 行)
总计: +4,670 行
2026-07-24 05:18:52 +00:00
茂之钳 c06d8f4d0a fix: 约束求解器测试期望修正 — DOF/矩形/角度容差
CI / Build & Test (push) Failing after 42s
CI / Release Build (push) Failing after 31s
2026-07-24 04:15:47 +00:00