point.squaredDistance(p)

Return the squared distance between the point and another point p.

p

Useful for distance comparisons in which real distance is not necessary (saves one Math.sqrt() operation).

Math.sqrt()