intersectsBox method

bool intersectsBox(
  1. BoundingBox box
)

Implementation

bool intersectsBox(BoundingBox box) {
  final planes = this.planes;

  for (int i = 0; i < 6; i++) {
    final plane = planes[i];

    // corner at max distance

    _vectorFrustum.x = plane.normal.x > 0 ? box.max.x : box.min.x;
    _vectorFrustum.y = plane.normal.y > 0 ? box.max.y : box.min.y;
    _vectorFrustum.z = plane.normal.z > 0 ? box.max.z : box.min.z;

    if (plane.distanceToPoint(_vectorFrustum) < 0) {
      return false;
    }
  }

  return true;
}