3D/2D library written in Rust. Offering useful containers, structures and algorithms for 2D and 3D space. Meant as basis for numeric algorithms, viewers, game engines, ...
rust-3d is still in really early stages, there might come breaking changes with each update.
The test coverage is far from perfect, so you might find some bugs (please report them).
Here's a little overview of some of
The snippets / names might not be up-to-date, so please check
tests/ for compiling examples.
.unwrap() where it's not 100% safe.
There's strong types for everything that might get mixed up easily. This way e.g. ids of faces can't be mistaken for ids of vertices.
fn edges_of_face(&self, faceid: FId) -> Result<(EId, EId, EId)>;
There's also smart types which restrict the values they can hold.
This way distances can never be
< 0.0, sizes can be enfored to be
> 0.0 etc.
I try and keep all algorithms and types as generic as possible (see
- Even rather basic types like
Is2Dare split into several versions:
IsMeshis defined for any vertex type and any number of vertices / face
- There's traits for collections (no need to use
This makes it possible to require as little implementation work as possible if you want to use your own types.
IsFilter<T>can be combined via
IsFilter<T>can be transformed to work for any collection of
IsDirectionField2Dmight be transformed to an
IsFilter<Is2D>, which can then be transformed to an
IO method is defined on traits, so if you implement these, you'll get read/write of different file formats for free.
The documentation is quite good already, come and take a look.
Please take a look at the tests in
tests/. These will be up-to-date and compiling.
I might add extensive tutorials / examples / demo projects in the future.
Feel free to open an issue in case you're missing something or found a bug. Please avoid directly contributing since I might be working on breaking changes or the feature you want to implement. Open an issue or email me beforehand.
LGPL (see LICENSE)
Distances between objects in 2D space
Distances between objects in 3D space
Distances between objects in ND space
functions used for the creation of 2D shapes and geometries
rust-3d trait implementations for standard containers / structs
interpolations within 2D space. E.g. bezier, linear, cosine
Containing IO functions / traits / types
Exporting often used types / traits for convenience
Containing strong type definitions for safer usage
helper functions for testing (these functions unwrap and panic, only use for tests)
Containing traits used by rust-3d
BoundingBox2D, an axis aligned bounding box within 2D space
BoundingBox3D, an axis aligned bounding box within 3D space
Box2D, a box in 2D space
Box3D, a box in 3D space
Circle, a circle in 2D space
Face3, a face defined by 3 indices (e.g. used for Mesh)
HalfEdge, the half edge data structure
Line2D, a line within 2D space
Line2D, a line within 3D space
LineSegment2D, a line segment within 2D space
LineSegment3D, a line segment within 3D space
Matrix3, a matrix with 3 rows and columns
Matrix4, a matrix with 4 rows and columns
Matrix3Pipe, which makes it easier to pipe different matrices in a defined order
Matrix4Pipe, which makes it easier to pipe different matrices in a defined order
Mesh3D, a mesh with tri-faces within 3D space
NonNegative, a wrapper for a f64 value, ensuring it is always >= 0
Norm2D, a normalized vector within 2D space
Norm3D, a normalized vector within 3D space
Plane3D, a plane within 3D space
Point2D, a point / position within 2D space
Point3D, a point / position within 3D space
PointCloud2D, a collection of positions within 2D space
PointCloud3D, a collection of positions within 3D space
Positive, a wrapper for a f64 value, ensuring it is always > 0
Ray2D, a ray within 2D space
Ray3D, a ray within 3D space
SearchableMesh, transforms IsMesh to IsSearchableMesh
Sphere, a sphere in 3D space
Used to flag precision e.g. for IO operations (32 or 64 bit)
View, which defines a restricted / full view onto any T. E.g. used when filtering collections of points.
Result type used by rust-3d