distanceSqr method

double distanceSqr(
  1. V2 o
)

Squared Euclidean distance between this vector and o.

Prefer over distance when only relative comparison is needed.

Implementation

double distanceSqr(V2 o) => (x - o.x)*(x - o.x) + (y - o.y)*(y - o.y);