static double distanceSq ( Point2D_I32 a , Point2D_I32 b ) { double dx = b . x - a . x ; double dy = b . y - a . y ; return dx * dx + dy * dy ; }
Using double prevision here instead of int due to fear of overflow in very large images