pub struct HeightGrid {
pub origin_x: f64,
pub origin_y: f64,
pub dx: f64,
pub dy: f64,
pub ncols: usize,
pub nrows: usize,
pub heights: Vec<f64>,
}Expand description
Terrain heights on an axis-aligned, uniform grid in metres. Row-major:
heights[i * ncols + j] is column j (east), row i (north). Position
y is up; the grid lies in the x–z plane.
Fields§
§origin_x: f64Frame-x of the first column centre.
origin_y: f64Frame-z of the first row centre.
dx: f64Column spacing, metres.
dy: f64Row spacing, metres.
ncols: usizeNumber of columns (east).
nrows: usizeNumber of rows (north).
heights: Vec<f64>Row-major height samples, ncols * nrows.
Implementations§
Source§impl HeightGrid
impl HeightGrid
Sourcepub fn new(
origin_x: f64,
origin_y: f64,
dx: f64,
dy: f64,
ncols: usize,
nrows: usize,
heights: Vec<f64>,
) -> Result<Self>
pub fn new( origin_x: f64, origin_y: f64, dx: f64, dy: f64, ncols: usize, nrows: usize, heights: Vec<f64>, ) -> Result<Self>
Build and validate a grid.
Sourcepub fn height_at(&self, x: f64, z: f64) -> f64
pub fn height_at(&self, x: f64, z: f64) -> f64
Terrain height at a horizontal position, bilinear between samples; clamps at the grid edges.
Sourcepub fn from_ascii(text: &str) -> Result<Self>
pub fn from_ascii(text: &str) -> Result<Self>
A grid from an ASCII ESRI .asc raster (projected, metres): header
ncols/nrows/xllcorner/yllcorner/cellsize, then row-major heights
(north-to-south, west-to-east).
Trait Implementations§
Source§impl Clone for HeightGrid
impl Clone for HeightGrid
Auto Trait Implementations§
impl Freeze for HeightGrid
impl RefUnwindSafe for HeightGrid
impl Send for HeightGrid
impl Sync for HeightGrid
impl Unpin for HeightGrid
impl UnsafeUnpin for HeightGrid
impl UnwindSafe for HeightGrid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more