intersectsWithSphere method

bool intersectsWithSphere(
  1. Sphere sphere
)

Check if this intersects with sphere.

Implementation

bool intersectsWithSphere(Sphere sphere) {
  final negativeRadius = -sphere.radius;
  final center = sphere.center;

  if (_plane0.distanceToVector3(center) < negativeRadius) {
    return false;
  }

  if (_plane1.distanceToVector3(center) < negativeRadius) {
    return false;
  }

  if (_plane2.distanceToVector3(center) < negativeRadius) {
    return false;
  }

  if (_plane3.distanceToVector3(center) < negativeRadius) {
    return false;
  }

  if (_plane4.distanceToVector3(center) < negativeRadius) {
    return false;
  }

  if (_plane5.distanceToVector3(center) < negativeRadius) {
    return false;
  }

  return true;
}