Crates.io | int_math |
lib.rs | int_math |
version | 0.0.2 |
source | src |
created_at | 2024-08-01 17:07:57.12613 |
updated_at | 2024-11-01 14:06:31.997471 |
description | Integer math |
homepage | |
repository | https://github.com/piot/int-math-rs |
max_upload_size | |
id | 1322240 |
size | 20,827 |
int_math
is a Rust crate providing mathematical abstractions for 2D vectors and rectangles. It includes:
UVec2
: A 2D vector with unsigned integer coordinates.Vec2
: A 2D vector with signed integer coordinates.Vec3
: A 3D vector with signed integer coordinates.URect
: A rectangle with unsigned integer coordinates for position and size.Rect
: A rectangle with signed integer coordinates for position and unsigned integer dimensions.UVec2
and Vec2
.Add int_math
to your Cargo.toml
:
[dependencies]
int_math = "0.0.2"
Then, use it in your code:
use int_math::{URect, UVec2};
let rect = URect::new(10, 20, 30, 40);
let center = rect.center();
println!("Center: {:?}", center);
Licensed under the MIT License. See the LICENSE file for details.