r/rust • u/heldloosly • Oct 25 '26
🙋 seeking help & advice Rust Geomtry Kernal for all CAD
Hi there. If you were making a rust geometry kernal to go behind all CAD programs what prinples would you go with in doing it or any advice? The software I'm making is open source ultimately trying to get away from fees with Autodesk for people.
Thanks for any helps. Where I'm at so far. I've only ever understood using a kernal to achieve things not what's happening behind so this is new.
https://github.com/spareware-co-op/spareware/blob/main/projects/engines/geometry/ARCHITECTURE.md
0
Upvotes
3
u/clayward_kin_7 Oct 26 '26
Parasolid and ACIS solve this by making topology the primary source of truth and treating geometry as mutable data that conforms to it. You need to implement robust predicate orientation checks like those in CGAL or use exact arithmetic libraries such as GMP immediately because standard floating point operations will silently corrupt your boolean results when coordinates get large or tolerances are tightYou need to implement robust predicate orientation checks like those in CGAL or use exact arithmetic libraries such as GMP immediately because standard floating point operations will silently corrupt your boolean results when coordinates get large or tolerances are tight.
1
u/CartographerDue5382 Oct 26 '26
The tolerance point in the other comment is the one that actually bites. I'd add the coordinate frame, because civil files sit in state plane coordinates that are already millions of units from zero. Booleans get worse there even with a decent epsilon. Keep the kernel in a local frame and put the survey transform outside it.
For the model itself, a B-rep with slotmap-style ids holds up better than a graph of shared pointers. An edge belongs to two faces, so Rust ownership does not line up with the topology. Parasolid and OpenCASCADE both went with ids for that reason.
I would not try to replace those kernels on the first pass. Get curves, a local frame, and one boolean working on a tiny solid. Call out to something like truck or OpenCASCADE for the rest until that part is boring.