intersectsSphere method

bool intersectsSphere(
  1. Sphere sphere
)

Implementation

bool intersectsSphere(Sphere sphere) {
  var planes = this.planes;
  var center = sphere.center;
  var negRadius = -sphere.radius;

  for (var i = 0; i < 6; i++) {
    var distance = planes[i].distanceToPoint(center);

    // print("i: ${i} distance: ${distance} negRadius: ${negRadius} ${distance < negRadius} ");

    if (distance < negRadius) {
      return false;
    }
  }

  return true;
}