Provides an octree interface for storing and querying objects in three-dimensional space.
- Source:
- See:
- To Do:
-
- Document private members
Methods
(static) create(optionsopt) → {syngen.utility.octree}
Instantiates a new octree.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{} |
Properties
|
- Source:
Returns:
(static) from(itemsopt, optionsopt) → {syngen.utility.octree}
Instantiates a new octree with items
and options
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
items |
Array.<Object> |
<optional> |
[] | |
options |
Object |
<optional> |
{} | See |
- Source:
Returns:
clear()
Clears all nodes and items.
- Source:
destroy()
Prepares the instance for garbage collection.
- Source:
find(query, radiusopt) → {Object|undefined}
Finds the closest item to query
within radius
.
If query
is contained within the tree, then the next closest item is returned.
If no result is found, then undefined
is returned.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
query |
Object |
Properties
|
||||||||||||||
radius |
Number |
<optional> |
Infinity |
- Source:
Returns:
- Type
- Object | undefined
insert(item)
Inserts item
into the tree.
Parameters:
Name | Type | Description |
---|---|---|
item |
Object |
- Source:
intersects(prism) → {Boolean}
Returns whether this node intersects the rectanglular prism prism
.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
prism |
Object |
Properties
|
- Source:
- See:
- To Do:
-
- Define a rectangular prism utility or type
Returns:
- Type
- Boolean
remove(item)
Removes item
from the tree, if it exists.
Parameters:
Name | Type | Description |
---|---|---|
item |
Object |
- Source:
retrieve(prism) → {Array.<Object>}
Retrieves all items within the rectanglular prism prism
.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
prism |
Object |
Properties
|
- Source:
- To Do:
-
- Define a rectangular prism utility or type
Returns:
- Type
- Array.<Object>