distanceToSquared method

double distanceToSquared(
  1. Vector3 v
)

Computes the squared distance from this vector to v. If you are just comparing the distance with another distance, you should compare the distance squared instead as it is slightly more efficient to calculate.

Implementation

double distanceToSquared(Vector3 v) {
  var dx = x - v.x, dy = y - v.y, dz = z - v.z;

  return dx * dx + dy * dy + dz * dz;
}