pub struct Viewport { pub aspect_ratio: f64, pub image_width: usize, pub image_height: usize, } impl Viewport { pub fn new(image_width: usize) -> Self { let aspect_ratio = 16.0 / 9.0; let image_height = ((image_width as f64 / aspect_ratio) as usize).max(1); Viewport { aspect_ratio, image_width, image_height, } } // TODO: Return a struct with it named width / height pub fn calculate_viewport(&self) -> (f64, f64) { let viewport_height = 2.0; let viewport_width = viewport_height * (self.image_width as f64 / self.image_height as f64); (viewport_width, viewport_height) } }