/// <summary> /// Calculates the square distance of the point to the polyline. /// </summary> /// <param name="polyline">The polyline.</param> /// <param name="point">The point.</param> /// <returns>Returns the squared distance.</returns> public static float SqrDistance(this IPolyline polyline, Vector3 point) { return((point - polyline.ClosestPoint(point)).sqrMagnitude); }