Crate vek [] [src]

Generic 2D-3D math swiss army knife for game engines, with SIMD support and focus on convenience.

See the wiki for an overview, FAQ, guides, and other info.

This crate is still in its alpha days! The public API is quite close to being stable, but it hasn't been battle-tested enough.
Also, some parts, such as geom and bezier, definitely miss some functionalities.
Issues and bug reports are very welcome!

Cargo features

  • serde makes vectors and matrices derive Serialize and Deserialize.
  • image makes color vectors implement the Pixel trait from the image crate.
  • vec8, vec16, vec32, vec64, rgba, rgb, extent3, uvw, uv, mat2, mat3, quaternion Enable these types. Restricting your selection drastically decreases compile times.
    Other types are always enabled for the sake of doc-tests.
    Enabling quaternion also unlocks the experimental Transform type.
  • geom enables the experimental geom module, which provides simple geometric primitives. In the future, it will be more feature-complete and provide optimized mass-processing routines.
  • bezier unlocks Bézier curve types.
  • repr_simd enables Nightly Rust's repr_simd and simd_ffi features, and unlock SIMD versions of all appropriate types (though repr_simd modules). On Stable, this feature has no effect.
  • x86intrin enables x86 intrinsics through the x86intrin crate. vek doesn't directly depend on it because it won't compile on Stable and there's no way (as of this writing) to selectively depend on a crate based on the rustc version, not even via build scripts.

#![no_std]

This crate is #![no_std].

Reexports

pub use mat::*;
pub use vec::*;
pub use ops::*;
pub use frustum::*;
pub use rect::*;
pub use tween::*;
pub use transform::*;
pub use quaternion::*;
pub use bezier::*;
pub use geom::*;

Modules

bezier

Bézier curves

frustum

The FrustumPlanes type.

geom

Common and trivial geometric primitives.

mat

Matrix types.

ops

Operations defined by this crate, such as MulAdd, Lerp, Clamp, and Wrap.

quaternion

Quaternions are a convenient representation for rotations in 3D spaces.

rect

A Rect container (x, y, w and h).

transform

A convenient position + orientation + scale container, backed by two Vec3 and a Quaternion.

tween

A convenience structure for storing a progression from one value to another.

vec

Vector types.