Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RecursiveShadowCasting<T>

Recursive Shadow Casting based on Björn Bergström's algorithm.

You can find an idea of how it works here: http://www.roguebasin.com/index.php?title=FOV_using_recursive_shadowcasting

const grid = [
[1, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
];

const fov = new RecursiveShadowCasting(grid, (c) => c === 0, { radius: 2 });

const result = fov.compute({ x: 0, y: 0 });

console.log(result);

{
status: 'Success',
positions: [
{ x: 0, y: 0 },
{ x: 1, y: 1 },
{ x: 1, y: 0 },
{ x: 0, y: 1 }
]
}

Type parameters

  • T

    Any type of data.

Hierarchy

  • FOV<T>
    • RecursiveShadowCasting

Index

Constructors

Methods

Constructors

Methods

Generated using TypeDoc