Crate coord[−][src]
coord
is a simple, ergonomic vector mathematics crate for Rust designed for use in game development, physics engines and other programs that deal with general-purpose multi-variable mathematics
Features
- Basic vector operations
- Basic primitive operations
- Basic mathematic operations upon vectors
- Macros that make manipulating vectors simpler
- Vector serialization
- Hash support
Coming Soon
- Bitwise vector operations
- More mathematic functions
- Conversion between primitive vectors of different types
Examples
#[macro_use] extern crate coord; use coord::prelude::*; fn main() { // Coord supports 4 multi-variable vector types: Vec1, Vec2, Vec3 and Vec4 let mut v = vec3!(1.0, 2.5, 3.0); // Coord supports common mathematical operations for both primitive and vector types // The macros support multiple methods of construction including arrays and tuples v += vec3![1.0; 3] * 5.0; let _ = v * vec3!([10.0, 10.0, 10.0]); // Coord implements many common mathematic functions let _ = v.length(); let _ = v.normalize(); // Coord supports debug and display printing of vectors println!("Debug => {:?}", v); println!("Display => {:?}", v); // Coord allows arbitrary vector component types let _ = vec2!(true, false); // Create a boolean vector }
Modules
defaults |
This module contains several type definitions that make working with |
macros |
Macro definitions |
math |
Mathematic functions and traits |
prelude |
This module contains a variety of commonly used types and functions. |
vec1 |
Functionality pertaining to |
vec2 |
Functionality pertaining to |
vec3 |
Functionality pertaining to |
vec4 |
Functionality pertaining to |
Macros
vec1 |
Neatly construct a |
vec2 |
Neatly construct a |
vec3 |
Neatly construct a |
vec4 |
Neatly construct a |
Traits
VecItem |
A trait implemented by all types that can exist within a vector |
Vector |
A trait implemented by all vector types |