blob: e2b1882656232ff3fc66d6b3a5758fab7af3fe8d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
use crate::geometry::Point2d;
use crate::geometry::Vec2d;
#[derive(Debug, Default, Clone, Copy, PartialEq)]
pub struct Rectangle<T> {
pub pos: Point2d<T>,
pub size: Vec2d<T>,
}
impl<T> Rectangle<T> {
pub fn new(x: T, y: T, w: T, h: T) -> Rectangle<T> {
Rectangle {
pos: Point2d::new(x, y),
size: Vec2d::new(w, h),
}
}
// TODO: Constructor to build a rectangle centered at an x,y
}
|