Get sum of values on axis.
double sum(Axis axis) { switch (axis) { case Axis.X: return left + right; case Axis.Y: return top + bottom; default: throw new IllegalArgumentException(); } }