squaredDistanceTo method

double squaredDistanceTo(
  1. Point other
)

Returns the squared distance to another point. More efficient than distanceTo when comparing distances.

Implementation

double squaredDistanceTo(Point other) {
  final dx = x - other.x;
  final dy = y - other.y;
  return dx * dx + dy * dy;
}