crater.rs

High-performance N-dimensional geometric modeling and analysis in Rust
⚠️ Pre-1.0 Development ⚠️
The API is evolving rapidly. Breaking changes may occur until version 1.0.0.
Overview
crater.rs is a powerful library for N-dimensional geometric modeling and computational analysis, built on the Burn machine learning framework. It enables GPU-accelerated geometric computations with support for CPU, CUDA, Metal, and WebGPU backends.
Interactive Gallery
Experience crater.rs in action with our interactive raycast gallery featuring mesh extraction.
Key Features
Constructive Solid Geometry (CSG)
- N-dimensional field operations with GPU acceleration via Burn tensors
- Implicit surface modeling using scalar field functions
f(x₁, x₂, ..., xₙ) ≤ 0 - Boolean operations (union, intersection, difference) with R-function smoothness
- Coordinate transformations (translation, rotation, scaling) with automatic differentiation
High-Performance Ray Casting
- Batch ray-surface intersection with 100k+ rays/second throughput
- AABB acceleration structures for complex geometries
- Multi-backend support (CPU, CUDA, Metal, WebGPU)
- Interactive visualization with real-time mesh overlays
3D Mesh Generation
- Marching Cubes algorithm for isosurface extraction
- Export support for STL, VTK, and other formats
- Paraview integration for scientific visualization
- High-resolution meshing with quality controls
Geometric Analysis
- Surface analysis (normals, gradients, curvature)
- Volume calculations for closed and open regions
- Trajectory analysis for ray-based simulations
- Interactive galleries for algorithm visualization
Quick Start
Add crater.rs to your project:
Basic Example
use *;
use Wgpu;
// Create a 3D sphere
let device = Defaultdefault;
let sphere = sphere;
// Convert to implicit surface region
let region = sphere.into_isosurface.region;
// Generate mesh using marching cubes
let mesh = marching_cubes;
Interactive Gallery
Run the interactive raycast gallery locally:
Then open raycast-gallery.html in your browser to explore ray casting with real-time mesh visualization.
Applications
Real-World Usage
phlux.rs- Monte Carlo neutron transport for nuclear reactor physics- Uses crater.rs ray casting for particle tracking in complex reactor geometries
Use Cases
- Scientific Computing: Volumetric analysis, surface extraction, field visualization
- Computer Graphics: Procedural modeling, collision detection, mesh generation
- Engineering: CAD operations, finite element preprocessing, geometric optimization
- Research: Algorithm development, computational geometry, physics simulation
Documentation
- Book - Comprehensive guide with theory and examples
- API Docs - Complete API reference with examples
- Examples - Working code samples and tutorials
License
This project is licensed under the MIT License - see the LICENSE file for details.