### 2 releases

0.0.2 | Nov 1, 2024 |
---|---|

0.0.1 | Aug 1, 2024 |

#**983** in Algorithms

**201** downloads per month

Used in **5** crates
(3 directly)

**MIT**license

18KB

264 lines

# 📐 int_math

is a Rust crate providing mathematical abstractions for 2D vectors and rectangles. It includes:`int_math`

: A 2D vector with unsigned integer coordinates.`UVec2`: A 2D vector with signed integer coordinates.`Vec2`: A 3D vector with signed integer coordinates.`Vec3`: A rectangle with unsigned integer coordinates for position and size.`URect`: A rectangle with signed integer coordinates for position and unsigned integer dimensions.`Rect`

## ✨ Features

**Vector Operations**: Supports basic arithmetic operations for

and`UVec2`

.`Vec2`**Rectangles**: Provides methods to create and manipulate rectangles, including calculating centers and applying offsets.

## 📦 Installation

Add

to your `int_math`

:`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.