Skip to main content

patch_border_edge

Function patch_border_edge 

Source
pub fn patch_border_edge(
    target: &mut ElevationGrid,
    neighbor: &ElevationGrid,
    dx: i32,
    dy: i32,
)
Expand description

Overwrite one border strip of target with edge data from neighbor, in place.

dx and dy describe the relative position of the neighbour with respect to the target tile:

(dx, dy)meaningborder written
( 0, -1)neighbour is northtop row
( 0, 1)neighbour is southbottom row
(-1, 0)neighbour is westleft column
( 1, 0)neighbour is eastright column
(-1, -1)neighbour is NWNW corner
( 1, -1)neighbour is NENE corner
(-1, 1)neighbour is SWSW corner
( 1, 1)neighbour is SESE corner

Both grids must be in expanded form ((W+2) x (H+2)) and have the same interior dimensions. If they differ, the call is a no-op.

After patching, target.min_elev / max_elev are updated if the newly written samples extend the range.