Skip to content

Hyperreal#120

Closed
timschmidt wants to merge 4 commits into
mainfrom
hyperreal
Closed

Hyperreal#120
timschmidt wants to merge 4 commits into
mainfrom
hyperreal

Conversation

@timschmidt
Copy link
Copy Markdown
Owner

@timschmidt timschmidt commented May 15, 2026

High-level PR Summary

This PR documents the porting strategy for migrating the csgrs geometry stack to use the hyperreal numeric 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 with thiserror derives and detailed variants, several methods that previously returned Option or unwrapped results now properly return Result types, and tests are updated to handle the new error-aware APIs.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 PORTING_PLAN.md
2 src/errors.rs
3 src/mesh/mod.rs
4 src/mesh/shapes.rs
5 src/sketch/extrudes.rs
6 src/polygon.rs
7 src/tests.rs
8 src/wasm/mesh_js.rs
9 src/io/stl.rs
10 src/csg.rs
11 src/main.rs

Need help? Join our Discord

timschmidt and others added 4 commits May 14, 2026 19:53
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>
@timschmidt timschmidt closed this May 15, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/tests.rs
assert_eq!(poly.metadata(), Some(&"Cube1".to_string()));
let data = poly.metadata().unwrap();
assert!(
data == "Cube1" || data == "Cube2",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The assertion in test_difference_metadata has been weakened to allow metadata from either operand (Cube1 or Cube2). In a CSG difference operation ($A - B$), the resulting polygons should ideally inherit the metadata of the primary object ($A$), including the surfaces created by the cut. The current implementation of 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant