Crates.io | crater-rs |
lib.rs | crater-rs |
version | 0.6.0 |
source | src |
created_at | 2024-10-02 22:55:38.600762+00 |
updated_at | 2025-03-06 03:17:29.814009+00 |
description | A library of solid modeling primitives and operations |
homepage | |
repository | https://gitlab.com/games1122013/crater.rs |
max_upload_size | |
id | 1394712 |
size | 2,356,312 |
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 😅
crater.rs
is a library for N-D
geometric modeling and analysis. It is distributed in both library and binary form to suit your needs.
N-D
Constructive Solid Geometry (CSG):
N
-variant closure, f(x1, x2, ..., xN) <= 0
.f1(x1, x2, ..., xN) <= 0 OR f2(x1, x2, ..., xN) <= 0
)N-D
basis (e.g., f(x1, x2, ..., xN) -> f(g_1(x1), g_2(x2), ... g_N(xN))
for some transformation g_i(xi)
).N=3
:
crater.rs
's MeshCollection
and TriangleMesh
types. Use this to export to common rendering formats (e.g., .stl
, .vtk
)N-D
Region analysis:
examples
for various implemented use cases of crater.rs
.obj
, .3ds
)N=2
serialization (i.e., drawing simple plots)> cargo install crater-rs
... Installs `crater` binary
Verify installation
> crater --version
... whatever the current version is ...
At time of writing, the Marching Cubes algorithm is crater
's only command-line feature. It takes a .yml
input file and emits .stl
files. (For a few example input files, see crater_examples
).
Here's a simple input
region: "-[(x^2 + y^2 + z^2 + 2.0^2 - 1.0^2)^2 - 4 * 2.0^2 * (x^2 + y^2)]" # A z-oriented torus
bounds: [[-5, -5, -5], [5, 5, 5]] # Render from [-5, 5] in each of the 3 dimensions
resolution: [50, 50, 50] # Evaluate 50 cubes in each of the 3 dimensions
> crater marching-cubes -i ./path/to/torus.yml -o torus.stl
which outputs a .stl
file. crater.rs
's CI/CD jobs run this exact example see (torus.stl
).
crater.rs
is distributed as a Rust 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
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.