intersectsBox method

bool intersectsBox(
  1. Box3 box
)

Implementation

bool intersectsBox(Box3 box) {
  var planes = this.planes;

  for (var i = 0; i < 6; i++) {
    var 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;
}