aabbQuery method

List<int> aabbQuery(
  1. AABB aabb,
  2. List<int> result
)

Get all data, potentially within an AABB @return The "result" object

Implementation

List<int> aabbQuery(AABB aabb, List<int> result){
  final List<OctreeNode> queue = [this];
  final children = this.children;
  for (int i = 0, N = children.length; i != N; i++) {
    children[i].aabbQuery(aabb, result);
  }
  while (queue.isNotEmpty) {
    final OctreeNode node = queue.removeLast();
    if (node.aabb.overlaps(aabb)) {
      result.addAll(node.data);
    }
    queue.addAll(node.children);
  }

  return result;
}