Skip to content

five-on-it / packages/world/src/audit/cores / BoxGrid

Class: BoxGrid<T> ​

Defined in: packages/world/src/audit/cores.ts:153

A grid of square cells holding items by their boxes, to find the ones near a box.

Type Parameters ​

T ​

T

Constructors ​

Constructor ​

new BoxGrid<T>(cell?): BoxGrid<T>

Defined in: packages/world/src/audit/cores.ts:158

A grid of cells cell metres on a side.

Parameters ​

cell? ​

number = 8

Returns ​

BoxGrid<T>

Methods ​

add() ​

add(box, item): void

Defined in: packages/world/src/audit/cores.ts:174

Adds an item under its box.

Parameters ​

box ​

readonly number[]

item ​

T

Returns ​

void


near() ​

near(box): Set<T>

Defined in: packages/world/src/audit/cores.ts:183

The items whose cells a box touches, each once.

Parameters ​

box ​

readonly number[]

Returns ​

Set<T>