MCPcopy Index your code
hub / github.com/I3ck/rust-3d

github.com/I3ck/rust-3d @0.34.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.34.0 ↗ · + Follow
1,193 symbols 2,927 edges 186 files 435 documented · 36%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

rust-3d

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, ...

Migration 0.29.0 -> 0.30.0

Note that the module structure changed. There's now only submodules for io and impls.
Also prelude was removed.
If you were using the prelude via rust_3d::prelude::*; you should now be able to just switch to rust_3d::*;.
If you were using explicit paths such as rust_3d::filters::combinators::FilterAll you should now use rust_3d::FilterAll.
Note that io and impls are still part of the module path.
This should make future usage easier, but might be painful for existing users.

Tour

Here's a little overview of some of rust-3d's features. The snippets / names might not be up-to-date, so please check tests/ for compiling examples.

Proper error handling

No .unwrap() where it's not 100% safe.

Strong / Smart Types

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.

Positive  
NonNegative

Generic Code Base

I try and keep all algorithms and types as generic as possible. - Even rather basic types like Is2D are split into several versions: IsEditable2D, IsBuildable2D - IsMesh is defined for any vertex type and any number of vertices / face - There's traits for collections (no need to use Vec)

This makes it possible to require as little implementation work as possible if you want to use your own types.

Combinators / Transformers

  • Any IsFilter<T> can be combined via FilterAND, FilterOR, FilterAny, FilterNegate...
  • Any IsFilter<T> can be transformed to work for any collection of Ts (IsFilterRandomAccessible).
  • IsDirectionField2D might be transformed to an IsFilter<Is2D>, which can then be transformed to an IsFilterRandomAccessible<Is2D>.

IO

Any IO method is defined on traits, so if you implement these, you'll get read/write of different file formats for free.

Documentation

You can find the documentation here.

Examples

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.

Links

crates.io
github.com
docs.rs

Contribute

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.

License

MIT (see LICENSE)

Extension points exported contracts — how you extend this code

IsScalable (Interface)
IsScalable trait used for types that can have their size scaled by a factor [19 implementers]
src/is_scalable.rs
Is2D (Interface)
Is2D is a trait used for types which are positioned within the 2D space [8 implementers]
src/is_2d.rs
IsMovable3D (Interface)
IsMovable3D trait used for types within 3D space which can be moved IsMovable3D is a trait used for types within 3D spac [14 …
src/is_movable_3d.rs
IsND (Interface)
IsND is a trait used for types which are positioned within the n-dimensional space [15 implementers]
src/is_nd.rs
IsMovable2D (Interface)
IsMovable2D trait used for types within 2D space which can be moved IsMovable2D is a trait used for types within 2D spac [11 …
src/is_movable_2d.rs
HasBoundingBox2D (Interface)
HasBoundingBox2D is a trait for types which have a bounding box [6 implementers]
src/has_bounding_box_2d.rs
HasLength (Interface)
HasLength trait used for types which have a physical length HasLength is a trait used for types which have a physical le [6 …
src/has_length.rs
HasBoundingBox3D (Interface)
HasBoundingBox3D is a trait for types which have a bounding box [9 implementers]
src/has_bounding_box_3d.rs

Core symbols most depended-on inside this repo

x
called by 168
src/box_2d.rs
y
called by 167
src/box_2d.rs
push
called by 162
src/impls/vec.rs
get
called by 135
src/positive.rs
len
called by 102
src/impls/vec.rs
z
called by 94
src/box_3d.rs
line
called by 83
src/io/types.rs
next
called by 80
src/half_edge.rs

Shape

Method 855
Function 154
Class 87
Interface 63
Enum 34

Languages

Rust100%

Modules by API surface

src/point_cloud_3d.rs39 symbols
src/point_cloud_2d.rs38 symbols
src/bounding_box_3d.rs35 symbols
src/bounding_box_2d.rs30 symbols
src/searchable_mesh.rs29 symbols
src/point_3d.rs26 symbols
src/dynamic_precision_index_vec.rs26 symbols
src/functions.rs25 symbols
src/point_2d.rs24 symbols
src/io/stl.rs22 symbols
src/io/ply/types.rs22 symbols
src/box_3d.rs22 symbols

For agents

$ claude mcp add rust-3d \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact