Hyperreal#120
Conversation
Adapt useful changes from TimTheBig/csgrs topic branches: subdivision allocation cleanup, richer validation errors, fallible TriMesh/Rapier conversion APIs, and extrusion zero-vector check cleanup. Co-authored-by: TimTheBig <132001783+TimTheBig@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request updates the porting plan documentation and significantly improves error handling by transitioning several Mesh methods to return Result<T, ValidationError> instead of panicking or returning Option. It also includes performance optimizations in triangle subdivision and extrusion logic. A review comment highlights that the changes to test_difference_metadata mask an underlying inconsistency in how CSG operations handle metadata propagation between optimized and fallback paths, suggesting that the test remain strict to ensure consistent behavior.
| assert_eq!(poly.metadata(), Some(&"Cube1".to_string())); | ||
| let data = poly.metadata().unwrap(); | ||
| assert!( | ||
| data == "Cube1" || data == "Cube2", |
There was a problem hiding this comment.
The assertion in test_difference_metadata has been weakened to allow metadata from either operand (Cube1 or Cube2). In a CSG difference operation (difference in src/mesh/mod.rs appears inconsistent: the optimized path (mesh-bbopt) correctly retags polygons from the second operand, while the fallback path does not. This test change masks that inconsistency. It is recommended to keep the test strict and ensure metadata propagation is consistent across all implementation paths.
High-level PR Summary
This PR documents the porting strategy for migrating the
csgrsgeometry stack to use thehyperrealnumeric backend and improves error handling across the codebase. The porting plan establishes branching discipline, ownership boundaries between crates (hyperreal,hyperlattice,hyperlimit,hypersolve), and integration of symbolic variables with infinitesimal perturbation machinery for robust geometric predicates. On the implementation side, error types are enhanced withthiserrorderives and detailed variants, several methods that previously returnedOptionor unwrapped results now properly returnResulttypes, and tests are updated to handle the new error-aware APIs.⏱️ Estimated Review Time: 15-30 minutes
💡 Review Order Suggestion
PORTING_PLAN.mdsrc/errors.rssrc/mesh/mod.rssrc/mesh/shapes.rssrc/sketch/extrudes.rssrc/polygon.rssrc/tests.rssrc/wasm/mesh_js.rssrc/io/stl.rssrc/csg.rssrc/main.rs