function put(point, data, octree, octant, depth) {

	let children = octant.children;
	let exists = false;
	let done = false;
	let i, l;

	if(octant.contains(point, octree.bias)) {

		if(children === null) {

			if(octant.points === null) {

				octant.points = [];
				octant.data = [];

			} else {

				for(i = 0, l = octant.points.length; !exists && i < l; ++i) {

					exists = octant.points[i].equals(point);

				}

			}

			if(exists) {

				octant.data[i - 1] = data;
				done = true;

			} else if(octant.points.length < octree.maxPoints || depth === octree.maxDepth) {

				octant.points.push(point.clone());
				octant.data.push(data);
				++octree.pointCount;
				done = true;

			} else {

				octant.split();
				octant.redistribute(octree.bias);
				children = octant.children;

			}

		}

		if(children !== null) {

			++depth;

			for(i = 0, l = children.length; !done && i < l; ++i) {

				done = put(point, data, octree, children[i], depth);

			}

		}

	}

	return done;

}
function put(point, data, octree, octant, depth) {

	let children = octant.children;
	let exists = false;
	let done = false;
	let i, l;

	if(octant.contains(point, octree.bias)) {

		if(children === null) {

			if(octant.points === null) {

				octant.points = [];
				octant.data = [];

			} else {

				for(i = 0, l = octant.points.length; !exists && i < l; ++i) {

					exists = octant.points[i].equals(point);

				}

			}

			if(exists) {

				octant.data[i - 1] = data;
				done = true;

			} else if(octant.points.length < octree.maxPoints || depth === octree.maxDepth) {

				octant.points.push(point.clone());
				octant.data.push(data);
				++octree.pointCount;
				done = true;

			} else {

				octant.split();
				octant.redistribute(octree.bias);
				children = octant.children;

			}

		}

		if(children !== null) {

			++depth;

			for(i = 0, l = children.length; !done && i < l; ++i) {

				done = put(point, data, octree, children[i], depth);

			}

		}

	}

	return done;

}
function put ( point , data , octree , octant , depth ) { let children = octant . children ; let exists = false ; let done = false ; let i , l ; if ( octant . contains ( point , octree . bias ) ) { if ( children === null ) { if ( octant . points === null ) { octant . points = [ ] ; octant . data = [ ] ; } else { for ( i = 0 , l = octant . points . length ; ! exists && i < l ; ++ i ) { exists = octant . points [ i ] . equals ( point ) ; } } if ( exists ) { octant . data [ i - 1 ] = data ; done = true ; } else if ( octant . points . length < octree . maxPoints || depth === octree . maxDepth ) { octant . points . push ( point . clone ( ) ) ; octant . data . push ( data ) ; ++ octree . pointCount ; done = true ; } else { octant . split ( ) ; octant . redistribute ( octree . bias ) ; children = octant . children ; } } if ( children !== null ) { ++ depth ; for ( i = 0 , l = children . length ; ! done && i < l ; ++ i ) { done = put ( point , data , octree , children [ i ] , depth ) ; } } } return done ; }
Recursively places a point into the octree.

@private
@param {Vector3} point - A point.
@param {Object} data - An object that the point represents.
@param {Octree} octree - The octree.
@param {Octant} octant - The current octant.
@param {Number} depth - The current depth.
@return {Boolean} Whether the operation was successful.
Recursively places a point into the octree .