new Map()
Map describes the structure that holds the objects of a scene.
It's an interface, so all implementation details should be
described in higher level classes.
- Source:
Methods
-
add(obj2d)
-
Adds an object to the map.
Parameters:
Name Type Description obj2d
Grape2D.Object2D The object to e added. - Source:
-
clear()
-
Clears the map.
- Source:
-
query(shape) → {!Array.<Grape2D.Object2D>}
-
Query the shape region, in this map.
Parameters:
Name Type Description shape
Grape2D.Shape The shape to query. - 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. - 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. - Source:
Returns:
Object that first encounters the ray.- Type
- Grape2D.Object2D
-
rebuild()
-
Reconstructs the internal representatio of the map, if needed be.
- Source:
-
remove(obj2d)
-
Removes an object from the map.
Parameters:
Name Type Description obj2d
Grape2D.Object2D The object to remove. - 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. - Source: