getAreaRatio method

double getAreaRatio ()
override

Get the ratio of the sum of the node areas to the root area.

@return

Implementation

double getAreaRatio() {
  if (_root == NULL_NODE) {
    return 0.0;
  }

  final int root = _root;
  double rootArea = _aabb[root].getPerimeter();

  double totalArea = 0.0;
  for (int i = 0; i < _nodeCapacity; ++i) {
    if (_height[i] < 0) {
      // Free node in pool
      continue;
    }

    totalArea += _aabb[i].getPerimeter();
  }

  return totalArea / rootArea;
}