13 releases (6 breaking)
Uses new Rust 2024
new 0.7.0 | Apr 30, 2025 |
---|---|
0.6.0 | Mar 6, 2025 |
0.5.0 | Feb 7, 2025 |
0.4.1 | Jan 17, 2025 |
0.1.4 | Oct 3, 2024 |
#347 in Math
121 downloads per month
4.5MB
4.5K
SLoC
This is Crater, the official mascot of crater.rs
!
⚠️ WARNING ⚠️
crater.rs
is still in early development. Until version1.0.0
, consider the public API mutable! I appreciate your patience ascrater.rs
matures 😅
Purpose
crater.rs
is a library for N-D
geometric modeling and analysis. It is built upon the Burn machine learning framework, allowing clients to leverage whatever backend (CPU, GPU, etc.) they wish.
Example: Ray Casting
Here's something you may create using crater.rs
(see the aabb_raycast
example). This is a little animation of crater.rs
's built-in raycasting library, which supports batched ray-isosurface intersection that is offloaded to the device of the users choosing.
M1 Macbook completes these 100,000 rays in a little under 2 seconds.
I can push my Macbook to its memory limits and solve for 3 million rays and hit a peak ray throughput of about 130,000 rays/s.
Features
N-D
Constructive Solid Geometry (CSG):- Batched, offloaded operations on fields via Burn
Tensor
s - Define your geometry entirely in terms of an
N
-variant closure,f(x1, x2, ..., xN) <= 0
. - Compose primitive closures together using differentiable, set-theoretic operations (e.g.,
f1(x1, x2, ..., xN) <= 0 OR f2(x1, x2, ..., xN) <= 0
) - Arbitrarily transform regions through covariant operations on the
N-D
basis (e.g.,f(x1, x2, ..., xN) -> f(g_1(x1), g_2(x2), ... g_N(xN))
for some transformationg_i(xi)
). - Ray-casting against field isosurfaces on device (Axis-Aligned Bounding Box implementation for acceleration when the number of rays is high)
- Batched, offloaded operations on fields via Burn
- For
N=3
:- Invoke the (offloaded) Marching Cubes algorithm to convert CSGs to triangular meshes
- Interact with
crater.rs
'sMeshCollection
andTriangleMesh
types. Use this to export to common rendering formats (e.g.,.stl
,.vtk
) Use Paraview as a drag and drop visualizer for these outputs.
N-D
Region analysis:- Surface normals, gradients, curvature, etc.
- Closed and open region volume calculations
- Refer to the
examples
for various implemented use cases ofcrater.rs
Quick Start
crater.rs
is distributed as a library crate for use as a dependency in your project(s).
> cargo add crater-rs
... adds `crater-rs` as a dependency of your crate
crater.rs
Users in the Wild!
phlux.rs
Monte Carlo Neutron Transport for the performant calculation of nuclear reactor physicsphlux.rs
usescrater.rs
's ray casting module for particle tracking against reactor geometries
Theory
crater.rs
leverages a wealth of abstract mathematical and computing techniques. Rather than detail all aspects of the underlying theory in the README.md
, check out the API documentation! There are numerous examples and explanations written inline.
Citations
- A. Ricci. "A constructive geometry for computer graphics" (1973)
- Vadim Shapiro. "Theory of R-Functions: A Primer" (1988)
- P.A. Fayolle and A. Pasko "An Evolutionary Approach to the Extraction of Object Construction Trees from 3D Point Clouds"
- A. Pasko, et. al. "Function Representation in Geometric Modeling: Concepts, Implementation and Applications"
- P. Bourke. "Polygonising a scalar field" (1994)
- N. Matsakis "Rayon Data Parallelism in Rust"
Dependencies
~65–105MB
~2M SLoC