API Docs for:
Show:

GL.Octree Class

Defined in: ../src/octree.js:5

Octree generator for fast ray triangle collision with meshes Dependencies: glmatrix.js (for vector and matrix operations)

Constructor

GL.Octree

(
  • mesh
)

Defined in ../src/octree.js:5

Parameters:

  • mesh Mesh

    object containing vertices buffer (indices buffer optional)

Item Index

Methods

testRay

(
  • origin
  • direction
  • dist_min
  • dist_max
)
HitTest

Test collision between ray and triangles in the octree

Parameters:

  • origin Vec3

    ray origin position

  • direction Vec3

    ray direction position

  • dist_min Number
  • dist_max Number

Returns:

HitTest:

object containing pos and normal

testSphere

(
  • origin
  • radius
)
Boolean

test collision between sphere and the triangles in the octree (only test if there is any vertex inside the sphere)

Parameters:

  • origin Vec3

    sphere center

  • radius Number

Returns:

Boolean:

true if the sphere collided with the mesh