2 releases

0.0.2 Nov 1, 2024
0.0.1 Aug 1, 2024

#467 in Math

Download history 28/week @ 2024-12-18 62/week @ 2024-12-25 22/week @ 2025-01-01 192/week @ 2025-01-08 61/week @ 2025-01-15 48/week @ 2025-01-22 8/week @ 2025-01-29 33/week @ 2025-02-05 27/week @ 2025-02-12 41/week @ 2025-02-19 82/week @ 2025-02-26 99/week @ 2025-03-05 69/week @ 2025-03-12 24/week @ 2025-03-19 92/week @ 2025-03-26 115/week @ 2025-04-02

327 downloads per month
Used in 40 crates (26 directly)

MIT license

18KB
264 lines

📐 int_math

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.

✨ Features

  • Vector Operations: Supports basic arithmetic operations for UVec2 and Vec2.
  • Rectangles: Provides methods to create and manipulate rectangles, including calculating centers and applying offsets.

📦 Installation

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);

License

Licensed under the MIT License. See the LICENSE file for details.

No runtime deps