+
+ int squareDistance(int x, int y) const
+ {
+ int xx = 0;
+ int yy = 0;
+
+ if (x < pos.x_)
+ xx = pos.x_ - x;
+ else if (x > pos.x_ + dim.wid)
+ xx = x - pos.x_ - dim.wid;
+
+ if (y < pos.y_ - dim.asc)
+ yy = pos.y_ - dim.asc - y;
+ else if (y > pos.y_ + dim.des)
+ yy = y - pos.y_ - dim.des;
+
+ // Optimisation: We avoid to compute the sqrt on purpose.
+ return xx*xx + yy*yy;
+ }