pub fn resize(&self, new_xpix: usize, new_ypix: usize) -> ImageDims {
        let cur_aspect = (self.xpix as f64) / (self.ypix as f64);
        let new_aspect = (new_xpix as f64) / (new_ypix as f64);
        let (c_x, c_y) = self.center();

        if new_aspect > cur_aspect {
            let new_w = self.height() * new_aspect;
            let n_x = c_x - new_w / 2.0;
            ImageDims {
                xpix: new_xpix,
                ypix: new_ypix,
                x: n_x,
                y: self.y,
                width: new_w,
            }
        } else {
            let new_h = self.width / new_aspect;
            let n_y = c_y + new_h / 2.0;
            ImageDims {
                xpix: new_xpix,
                ypix: new_ypix,
                x: self.x,
                y: n_y,
                width: self.width,
            }
        }
    }
/**
    Return a new view centered on the same spot, but with the aspect
    ratio changed.

    The new view will cover at least as much of the plane as the current one.
    */
Return a new view centered on the same spot, but with the aspect
ratio changed.

The new view will cover at least as much of the plane as the current one.
Return a new view centered on the same spot but with the aspect ratio changed . The new view will cover at least as much of the plane as the current one .
pub fn resize(&self, new_xpix: usize, new_ypix: usize) -> ImageDims {
        let cur_aspect = (self.xpix as f64) / (self.ypix as f64);
        let new_aspect = (new_xpix as f64) / (new_ypix as f64);
        let (c_x, c_y) = self.center();
        if new_aspect > cur_aspect {
            let new_w = self.height() * new_aspect;
            let n_x = c_x - new_w / 2.0;
            ImageDims {
                xpix: new_xpix,
                ypix: new_ypix,
                x: n_x,
                y: self.y,
                width: new_w,
            }
        } else {
            let new_h = self.width / new_aspect;
            let n_y = c_y + new_h / 2.0;
            ImageDims {
                xpix: new_xpix,
                ypix: new_ypix,
                x: self.x,
                y: n_y,
                width: self.width,
            }
        }
    }
pub fn resize ( & self , new_xpix : usize , new_ypix : usize ) -> ImageDims { let cur_aspect = ( self . xpix as f64 ) / ( self . ypix as f64 ) ; let new_aspect = ( new_xpix as f64 ) / ( new_ypix as f64 ) ; let ( c_x , c_y ) = self . center ( ) ; if new_aspect > cur_aspect { let new_w = self . height ( ) * new_aspect ; let n_x = c_x - new_w / 2.0 ; ImageDims { xpix : new_xpix , ypix : new_ypix , x : n_x , y : self . y , width : new_w , } } else { let new_h = self . width / new_aspect ; let n_y = c_y + new_h / 2.0 ; ImageDims { xpix : new_xpix , ypix : new_ypix , x : self . x , y : n_y , width : self . width , } } }
Return a new view centered on the same spot, but with the aspect
ratio changed.
Return a new view centered on the same spot but with the aspect ratio changed .
&self
new_xpix
usize
new_ypix
usize
&self
new_xpix
usize
new_ypix
usize