distanceSqToPoint method

num distanceSqToPoint(
  1. Vector3 point
)

Implementation

num distanceSqToPoint(Vector3 point) {
  var directionDistance = _vector.subVectors(point, origin).dot(direction);

  // point behind the ray

  if (directionDistance < 0) {
    return origin.distanceToSquared(point);
  }

  _vector.copy(direction).multiplyScalar(directionDistance).add(origin);

  return _vector.distanceToSquared(point);
}