GL.Octree Class
Octree generator for fast ray triangle collision with meshes Dependencies: glmatrix.js (for vector and matrix operations)
Constructor
GL.Octree
(
-
mesh
Parameters:
-
meshMeshobject containing vertices buffer (indices buffer optional)
Item Index
Methods
Methods
testRay
(
HitTest
-
origin -
direction -
dist_min -
dist_max
Test collision between ray and triangles in the octree
Parameters:
-
originVec3ray origin position
-
directionVec3ray direction position
-
dist_minNumber -
dist_maxNumber
Returns:
HitTest:
object containing pos and normal
testSphere
(
Boolean
-
origin -
radius
test collision between sphere and the triangles in the octree (only test if there is any vertex inside the sphere)
Parameters:
-
originVec3sphere center
-
radiusNumber
Returns:
Boolean:
true if the sphere collided with the mesh
