Represents a line of sight finder between two cells in a two dimensional array using a simple linear interpolation.
Inspired by: https://www.redblobgames.com/grids/line-drawing.html#interpolation
const line = new LineLerp( [ [0, 0, 0], [0, 0, 0], [0, 0, 0] ], (c) => c === 1 ); const result = line.process({ x: 0, y: 0 }, { x: 2, y: 2 }); console.log(result); { status: 'Complete', positions: [ { x: 0, y: 0 }, { x: 1, y: 1 }, { x: 2, y: 2 } ] }
Any type of data.
The grid for which to compute the line.
A callback function used to determine if a cell is a blocking one.
Retrieves a line between a start and an end Position.
Position
A Position
The line result.
Generated using TypeDoc
Represents a line of sight finder between two cells in a two dimensional array using a simple linear interpolation.
Inspired by: https://www.redblobgames.com/grids/line-drawing.html#interpolation