src/core/Octree.js
function findOctantsByLevel(octant, level, depth, result) {

	const children = octant.children;

	let i, l;

	if(depth === level) {

		result.push(octant);

	} else if(children !== null) {

		++depth;

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

			findOctantsByLevel(children[i], level, depth, result);

		}

	}

}
function findOctantsByLevel(octant, level, depth, result) {

	const children = octant.children;

	let i, l;

	if(depth === level) {

		result.push(octant);

	} else if(children !== null) {

		++depth;

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

			findOctantsByLevel(children[i], level, depth, result);

		}

	}

}
function findOctantsByLevel ( octant , level , depth , result ) { const children = octant . children ; let i , l ; if ( depth === level ) { result . push ( octant ) ; } else if ( children !== null ) { ++ depth ; for ( i = 0 , l = children . length ; i < l ; ++ i ) { findOctantsByLevel ( children [ i ] , level , depth , result ) ; } } }
Recursively fetches all octants with the specified depth level.

@private
@param {Octant} octant - An octant.
@param {Number} level - The target depth level.
@param {Number} depth - The current depth level.
@param {Octant[]} result - A list to be filled with the identified octants.
Recursively fetches all octants with the specified depth level .