Cell(aabb)

Class for representing a single partition in context of cell-space partitioning.

new Cell(aabb)

Constructs a new cell with the given values.

Parameters:
Name Type Description
aabb AABB

The bounding volume of the cell.

Author:

Members

aabb :AABB

The bounding volume of the cell.

readonly entries :Array.<Any>

The list of entries which belong to this cell.

Methods

add(entry) → {Cell}

Adds an entry to this cell.

Parameters:
Name Type Description
entry Any

The entry to add.

Returns:
Cell -

A reference to this cell.

empty() → {Boolean}

Returns true if this cell is empty.

Returns:
Boolean -

Whether this cell is empty or not.

fromJSON(json) → {Cell}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
Cell -

A reference to this game entity.

intersects(aabb) → {Boolean}

Returns true if the given AABB intersects the internal bounding volume of this cell.

Parameters:
Name Type Description
aabb AABB

The AABB to test.

Returns:
Boolean -

Whether this cell intersects with the given AABB or not.

makeEmpty() → {Cell}

Removes all entries from this cell.

Returns:
Cell -

A reference to this cell.

remove(entry) → {Cell}

Removes an entry from this cell.

Parameters:
Name Type Description
entry Any

The entry to remove.

Returns:
Cell -

A reference to this cell.

resolveReferences(entities) → {Cell}

Restores UUIDs with references to GameEntity objects.

Parameters:
Name Type Description
entities Map.<String, GameEntity>

Maps game entities to UUIDs.

Returns:
Cell -

A reference to this cell.

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.