Expand description
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.norm();
// 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
coord
simpler and faster - macros
- Macro definitions
- math
- Mathematic functions and traits
- prelude
- This module contains a variety of commonly used types and functions.
- vec1
- Functionality pertaining to
Vec1
- vec2
- Functionality pertaining to
Vec2
- vec3
- Functionality pertaining to
Vec3
- vec4
- Functionality pertaining to
Vec4
Macros§
- vec1
- Neatly construct a
Vec1
from arbitrary components - vec2
- Neatly construct a
Vec2
from arbitrary components - vec3
- Neatly construct a
Vec3
from arbitrary components - vec4
- Neatly construct a
Vec4
from arbitrary components