#vfx #graphics #traits #imath #vec2 #vec3

imath-traits

Utility traits for VFX libraries to be agnostic over the math crates used

7 releases (breaking)

0.7.0 Jul 28, 2022
0.6.0 Nov 16, 2021
0.5.0 Nov 16, 2021
0.4.0 Jul 3, 2021
0.1.0 May 25, 2021

#533 in Graphics APIs


Used in 2 crates

Custom license

37KB
1.5K SLoC

imath-traits

imath-traits provides a set of traits which constrain the types used in Rust translations of C++ APIs that rely on Imath, or Imath-alike types.

This is solely about memory layout and being able to convert the implementing types back and forward into slices and pointers to be able to be used in the FFI call, thus the traits contain no methods other than for converting back and forth between slices and raw pointers.

To use, simply add the feature for the math crate you need to the dependency of any crate that uses imath-traits (these will be called imath_<crate>, and types will just work with any function from that crate that expects a Vec2, Vec3, Vec4, Bound2 or Bound3:

openexr = { version = "0.10-3.0.1", features=["imath_cgmath"] }

Currently, we support glam, nalgebra and nalgebra_glm. If you need another math crate, implement support for it and submit a PR, or request it. Note that the crate must support 2-, 3- and 4-dimensional vectors of i32, f32 and f64.

Dependencies

~0.2–1.6MB
~41K SLoC