Skip to content

Octree

cjcliffe edited this page · 3 revisions

CubicVR.Octree

Creates an Octree.

Constructor:

Octree( size, max_depth, root, position, child_index )

Parameters:

  • size : Edge length of initial bounding box.
  • max_depth : Maximum depth of the octree.
  • root : An OctreeNode to be the root node (optional).
  • position : (default: [0,0,0])
  • child_index

Methods:

destroy()

Empties an octree of all child nodes and references.

Returns:

none

remove ( node )

Removes node from an octree.

Parameters:

  • node : Node to remove.

Returns:

none

contains_point( point )

Test if point lies within bounding box.

Parameters:

  • point : [x,y,z]

Returns:

true or false

toString()

Purpose:

Get useful debugging info about an octree.

Returns:

String info.

Example usage:

From tests/octree/octree.html:

var octree, scene;

// ...

octree = new CubicVR.Octree(400, 6);
scene = new CubicVR.Scene(canvas.width, canvas.height, 40, 0.1, 200, octree);

See also:

Something went wrong with that request. Please try again.