pub struct Raster {
pub grid: ChunkGrid,
pub data: Vec<f32>,
}Expand description
A raster grid with floating point values and a chunk grid for spatial reference.
Fields§
§grid: ChunkGridChunk grid that defines the raster domain and resolution.
data: Vec<f32>Raster data stored in row-major order (including halo).
Implementations§
Source§impl Raster
impl Raster
Sourcepub fn new(grid: ChunkGrid) -> Self
pub fn new(grid: ChunkGrid) -> Self
Create a new raster with the given chunk grid, initializing all values to zero.
Sourcepub fn size(&self) -> (usize, usize)
pub fn size(&self) -> (usize, usize)
Get the size of the raster as (width, height), including halo regions.
Sourcepub fn get(&self, ix: isize, iy: isize) -> f32
pub fn get(&self, ix: isize, iy: isize) -> f32
Get the value at the given grid indices, returning 0.0 if out of bounds.
Sourcepub fn sample_domain(&self, p: Vec2) -> f32
pub fn sample_domain(&self, p: Vec2) -> f32
Sample the raster at a world position, rounding to the nearest cell center.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Raster
impl Freeze for Raster
impl RefUnwindSafe for Raster
impl Send for Raster
impl Sync for Raster
impl Unpin for Raster
impl UnsafeUnpin for Raster
impl UnwindSafe for Raster
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