static double perimeter(AABB a) { double wx = a[2] - a[0]; double wy = a[3] - a[1]; return 2.0 * (wx + wy); }