Class: BVHTree

Grape2D. BVHTree

new BVHTree()

A bounding volume hierarchy (BVH) organizes a bounding volumes according to an hierarchy.
Source:

Extends

Methods

add(obj2d)

Adds an object to the map.
Parameters:
Name Type Description
obj2d Grape2D.Object2D The object to e added.
Inherited From:
Source:

clear()

Clears the map.
Inherited From:
Source:

query(shape) → {!Array.<Grape2D.Object2D>}

Query the shape region, in this map.
Parameters:
Name Type Description
shape Grape2D.Shape The shape to query.
Inherited From:
Source:
Returns:
All the objects inside the shape.
Type
!Array.<Grape2D.Object2D>

queryPoint(vector) → {!Array.<Grape2D.Object2D>}

Query the point in this map.
Parameters:
Name Type Description
vector Grape2D.Vector The vector to query.
Inherited From:
Source:
Returns:
All objects that contains the point.
Type
!Array.<Grape2D.Object2D>

queryRay(start, direction, length) → {Grape2D.Object2D}

Queries a ray against the map.
Parameters:
Name Type Description
start Grape2D.Vector Ray start position
direction Grape2D.Vector Direction of the ray
length number Maximum length of the ray.
Inherited From:
Source:
Returns:
Object that first encounters the ray.
Type
Grape2D.Object2D

rebuild()

Reconstructs the internal representatio of the map, if needed be.
Inherited From:
Source:

remove(obj2d)

Removes an object from the map.
Parameters:
Name Type Description
obj2d Grape2D.Object2D The object to remove.
Inherited From:
Source:

update(dt, scene)

Updates all the objects of the map.
Parameters:
Name Type Description
dt number Time elapsed.
scene Grape2D.Scene The scene, that the map represents.
Inherited From:
Source: