new OctreeNode( [box])
Create a new Octree node.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
box |
THREE.Box3 |
<optional> |
An optional bounding box for this octree, defaults to undefined. |
Members
-
:THREE.Box|null
box
-
The bounding extents of this spatial node.
Type
- THREE.Box | null
-
:Array
subTrees
-
Stores any subtrees within this spatial node.
Type
- Array
-
:Array
triangles
-
Stores the triangles at this spatial node.
Type
- Array
Methods
-
getCapsuleTriangles(capsule, triangles)
-
Collects all the triangles from the subtrees intersected by the given capsule.
The aim of this method is to reduce the number of triangle intersection tests to only those that the capsule has any possibility of intersecting. Thus, you only need to test those that are added to the
trianglesarray.Parameters:
Name Type Description capsulePD.Capsule The capsule to intersect the octree with.
trianglesArray The array to add test triangles to.
Returns:
Returns the
trianglesarray.- Type
- Array
-
getIntersectedNodes(ray, nodes)
-
Collects all nodes from the subtrees intersected by the given ray.
The aim of this method is to reduce the number of node/triangle intersection tests to only those that the ray has any possibility of intersecting. Thus, you only need to test the
triangleswithin the nodes added to the array.Parameters:
Name Type Description rayTHREE.Ray The ray to intersect the octree with.
nodesArray An array to add intersected tree nodes to.
Returns:
Returns the
trianglesarray.- Type
- Array
-
getRayTriangles(ray, triangles)
-
Collects all the triangles from the subtrees intersected by the given ray.
The aim of this method is to reduce the number of triangle intersection tests to only those that the ray has any possibility of intersecting. Thus, you only need to test those that are added to the
trianglesarray.Parameters:
Name Type Description rayTHREE.Ray The ray to intersect the octree with.
trianglesArray An array to add test triangles to.
Returns:
Returns the
trianglesarray.- Type
- Array
-
getSphereTriangles(sphere, triangles)
-
Collects all the triangles from the subtrees intersected by the given sphere.
The aim of this method is to reduce the number of triangle intersection tests to only those that the sphere has any possibility of intersecting. Thus, you only need to test those that are added to the
trianglesarray.Parameters:
Name Type Description sphereTHREE.Sphere The sphere to intersect the octree with.
trianglesArray The array to add test triangles to.
Returns:
Returns the
trianglesarray.- Type
- Array