Constructor
new OctreeHelper(renderer, geometryName, shaderName, target, options)
- Source:
Properties:
| Name | Type | Description | 
|---|---|---|
| opts | * | An object containing options. | 
| target | Lore.PointHelper | The Lore.PointHelper object from which this octree is constructed. | 
| renderer | Lore.Renderer | An instance of Lore.Renderer. | 
| octree | Lore.Octree | The octree associated with the target. | 
| raycaster | Lore.Raycaster | An instance of Lore.Raycaster. | 
| hovered | Object | The currently hovered item. | 
| selected | Array.<Object> | The currently selected items. | 
Creates an instance of OctreeHelper.
Parameters:
| Name | Type | Description | 
|---|---|---|
| renderer | Lore.Renderer | A Lore.Renderer object. | 
| geometryName | String | The name of this geometry. | 
| shaderName | String | The name of the shader used to render this octree. | 
| target | Lore.PointHelper | The Lore.PointHelper object from which this octree is constructed. | 
| options | Object | The options used to draw this octree. | 
Methods
addEventListener(eventName, callback)
- Source:
Add an event listener to this Lore.OctreeHelper object.
Parameters:
| Name | Type | Description | 
|---|---|---|
| eventName | String | The name of the event to listen for. | 
| callback | function | A callback function called when an event is fired. | 
addSelected(item)
- Source:
Adds an object to the selected collection of this Lore.OctreeHelper object.
Parameters:
| Name | Type | Description | 
|---|---|---|
| item | Object | Number | Either an item (used internally) or the index of a vertex from the associated Lore.PointHelper object. | 
clearSelected()
- Source:
Clear the selected collection of this Lore.OctreeHelper object.
destruct()
- Source:
Remove eventhandlers from associated controls.
drawBoxes()
- Source:
Draw the axis-aligned bounding boxes of this octree.
drawCenters()
- Source:
Draw the centers of the axis-aligned bounding boxes of this octree.
getIntersections(mouse) → {Array.<Object>}
- Source:
Get the indices and distances of the vertices currently intersected by the ray sent from the mouse position.
Parameters:
| Name | Type | Description | 
|---|---|---|
| mouse | Object | A mouse object containing x and y properties. | 
Returns:
A distance-sorted (ASC) array containing the interesected vertices.
- Type
- Array.<Object>
getScreenPosition(index) → {Array.<Number>}
- Source:
Get the screen position of a vertex by its index.
Parameters:
| Name | Type | Description | 
|---|---|---|
| index | Number | The index of a vertex. | 
Returns:
An array containing the screen position. E.g. [122, 290].
- Type
- Array.<Number>
hide()
- Source:
Hide the centers or cubes of the axis-aligned bounding boxes associated with this octree.
init()
- Source:
Initialize this octree.
raiseEvent(eventName, data)
- Source:
Raise an event with a given name and send the data to the functions listening for this event.
Parameters:
| Name | Type | Description | 
|---|---|---|
| eventName | String | The name of the event to be rised. | 
| data | * | Data to be sent to the listening functions. | 
rayIntersections(indices) → {Array.<Number>}
- Source:
Execute a ray intersection search within this octree.
Parameters:
| Name | Type | Description | 
|---|---|---|
| indices | Array.<Number> | The indices of the octree nodes that are intersected by the ray. | 
Returns:
An array containing the vertices intersected by the ray.
- Type
- Array.<Number>
removeSelected(index)
- Source:
Remove an item from the selected collection of this Lore.OctreeHelper object.
Parameters:
| Name | Type | Description | 
|---|---|---|
| index | Number | The index of the item in the selected collection. | 
selectedContains(index) → {Boolean}
- Source:
Check whether or not the selected collection of this Lore.OctreeHelper object contains a vertex with a given index.
Parameters:
| Name | Type | Description | 
|---|---|---|
| index | Number | The index of a vertex in the associated Lore.PointHelper object. | 
Returns:
A boolean indicating whether or not the selected collection of this Lore.OctreeHelper contains a vertex with a given index.
- Type
- Boolean
selectHovered()
- Source:
Add the currently hovered vertex to the collection of selected vertices.
setHovered(index)
- Source:
Adds a vertex with a given index to the currently hovered vertex of this Lore.OctreeHelper object.
Parameters:
| Name | Type | Description | 
|---|---|---|
| index | Number | The index of a vertex in the associated Lore.PointHelper object. | 
setPointSizeFromZoom(zoom)
- Source:
Sets the point size of the associated Lore.PointHelper object as well as the threshold for the associated raycaster used for vertex picking.
Parameters:
| Name | Type | Description | 
|---|---|---|
| zoom | Number | The current zoom value of the orthographic view. | 
setThreshold(threshold)
- Source:
Set the threshold of the raycaster associated with this Lore.OctreeHelper object.
Parameters:
| Name | Type | Description | 
|---|---|---|
| threshold | Number | The threshold (maximum distance to the ray) of the raycaster. | 
showCenters()
- Source:
Show the centers of the axis-aligned bounding boxes of this octree.
showCubes()
- Source:
Show the axis-aligned boudning boxes of this octree as cubes.