tridify_rs/core/
math.rs

1use glam::*;
2
3#[derive(Default)]
4pub struct Rect {
5    /// Bottom left from the rect
6    pub pos: Vec2,
7    pub size: Vec2,
8}
9impl Rect {
10    pub fn new(pos: Vec2, size: Vec2) -> Self { Self { pos, size } }
11    pub fn from_min_max(min: Vec2, max: Vec2) -> Self { Self::new(min, max - min) }
12    pub fn center(&self) -> Vec2 { self.pos + self.size / 2.0 }
13}