[][src]Crate definitive

The definitive vector and matrix library for Rust

In short

XKCD

My take on a vector library, that tries to be the be-all end-all vector and matrix crate through hand written SIMD for games and const generics for scientific compute.

In order to achieve this, definitive relies on experimental Rust features, such as const generics and specialization. This puts definitive in the experimental category, as it may cause internal compiler errors or undefined behaviour.

Matrices?

You might ponder, for a vector and matrix library, definitive doesn't seem to have any matrices! This is an unfortunate issue that I am currently facing with const generics that should be resolved in the future. Before support in rustc matures, definitive will support "good enough" matrices that aren't const sized.

Example

use definitive::Vector;

let a = Vector::from([2, 3, 1]);
let b = Vector::from([8, 0, 0]);

dbg!(a + b * 4);
// [34, 3, 1]

#![no_std] is supported by disabling the std feature

Macros

vector

Create a vector out of named arguments

Structs

Vector

A generic type representing an N dimensional vector

Traits

One

Value representing one, like 1.0f32 or 1i8

Sqrt

Square root

Zero

Value representing zero, like 0.0f32 or 0i8

Type Definitions

Vec2

Shorthand for Vector<f32, 2>

Vec3

Shorthand for Vector<f32, 3>

Vec4

Shorthand for Vector<f32, 4>