Skip to main content

y_centre

Function y_centre 

Source
pub fn y_centre(dim: &Dimension, extent: &Extent) -> Vec<f64>
Expand description

Y-coordinates of cell centres for each row.

Returns a vector of length dim[1], from top (ymax side) to bottom (ymin side).

ยงExample

use vaster::y_centre;

let ys = y_centre(&[4, 3], &[0.0, 4.0, 0.0, 3.0]);
assert_eq!(ys.len(), 3);
assert!((ys[0] - 2.5).abs() < 1e-10);  // top row
assert!((ys[2] - 0.5).abs() < 1e-10);  // bottom row