Function veloren_world::sim::erosion::get_multi_rec

source ยท
pub fn get_multi_rec<F: Debug + Float + Sync + Into<f64>>(
    map_size_lg: MapSizeLg,
    h: impl Fn(usize) -> F + Sync,
    downhill: &[isize],
    newh: &[u32],
    wh: &mut [F],
    nx: usize,
    ny: usize,
    dx: f64,
    dy: f64,
    _maxh: F,
    threadpool: &ThreadPool,
) -> (Box<[u8]>, Box<[u32]>, Box<[[f64; 8]]>)
Expand description

Algorithm for computing multi-receiver flow.

  • map_size_lg: Size of the underlying map.
  • h: altitude
  • downhill: single receiver
  • newh: single receiver stack
  • wh: buffer into which water height will be inserted.
  • nx, ny: resolution in x and y directions.
  • dx, dy: grid spacing in x- and y-directions
  • maxh: maximum |height| among all nodes.

Updates the water height to a nearly planar surface, and returns a 3-tuple containing:

  • A bitmask representing which neighbors are downhill.
  • Stack order for multiple receivers (from top to bottom).
  • The weight for each receiver, for each node.