intersectsWithSphere method

bool intersectsWithSphere (Sphere sphere)

Check if this intersects with sphere.

Implementation

bool intersectsWithSphere(Sphere sphere) {
  final double negativeRadius = -sphere._radius;
  final Vector3 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;
}