mod aligner;
pub mod colours;
mod drawer;
pub mod shapes;
pub use aligner::Aligner;
pub use drawer::Drawer;
pub use shapes::Shape;
pub type Vec2<T> = [T; 2];
pub type Point = Vec2<isize>;
pub type Size = Vec2<usize>;
pub fn calculate_size(shape: &Shape) -> Size {
let mut x_values = shape
.points()
.into_iter()
.map(|point| point[0])
.collect::<Vec<isize>>();
x_values.sort();
let greatest_x = x_values[0];
let smallest_x = x_values[x_values.len() - 1];
let width = smallest_x - greatest_x;
let mut y_values = shape
.points()
.into_iter()
.map(|point| point[1])
.collect::<Vec<isize>>();
y_values.sort();
let greatest_y = y_values[0];
let smallest_y = y_values[y_values.len() - 1];
let height = smallest_y - greatest_y;
[width as usize, height as usize]
}