6 releases
0.1.5 | Aug 28, 2023 |
---|---|
0.1.4 | Aug 24, 2023 |
#2088 in Data structures
34 downloads per month
11KB
227 lines
vector2
Vector2 is a simple library for using and creating 2D vectors.
Example
use vector2::Vector2;
// Create a Vector2
let vector2 = Vector2::new(1.0, 0.5);
// (1.0, 0.0)
let other = Vector2::RIGHT;
// Add two Vector2s
let added = vector2 + other;
assert_eq!(added.x, 2.0);
assert_eq!(added.y, 0.5);
lib.rs
:
Create and use 2D vectors
Example
use vector2::Vector2;
// Create a Vector2
let vector2 = Vector2::new(1.0, 0.5);
// (1.0, 0.0)
let other = Vector2::RIGHT;
// Add two Vector2s
let added = vector2 + other;
assert_eq!(added.x, 2.0);
assert_eq!(added.y, 0.5);