lmaths

Crates.iolmaths
lib.rslmaths
version1.0.5
sourcesrc
created_at2022-03-27 12:26:06.930214
updated_at2022-04-08 16:48:37.587472
descriptionA short 2D Maths library
homepagehttps://github.com/Carbone13/lmaths
repositoryhttps://github.com/Carbone13/lmaths
max_upload_size
id557247
size12,620
Lucas Michaudel (Carbone13)

documentation

README

L-Maths

Documentation Version License

Short 2D Maths library. Currently implements Vector2 (64-bit floats) and Point2 (integer), with their classic functions such as length(), normalize(), dot() etc...

Nothing fancy, just a good base for my projects.

Planning to implement other useful structs, like Matrices.

Examples :

Creating a Vector2 :

let v1 = Vector2::new(1.0, 5.6); //
// or using constants
let v2 = Vector2::ZERO; // (0.0, 0.0)

Same process for Point2 :

let p1 = Point2::new(-56, 45); //
// or using constants
let p2 = Point2::X_UNIT; // (1, 0)

Some demo for the functions :

let v3 = v1.normalized(); // won't modify v1
v1.normalize() // will modify v1
let dp = v1.dot(v2);
// or
let dp = Vector2::dot(v1, v2);
Commit count: 19

cargo fmt