sclass QuadTreeBitMatrix > WidthAndHeightImpl { sclass Node {} sclass On > Node {} sclass Off > Node {} sclass Composite > Node { Node a, b, c, d; } *() {} *(int *width, int *height) {} int half(int x) { ret roundUpToPowerOfTwo((x+1)/2); } Rect rectA(Rect r) { ret rect(r.x, r.y, half(r.w), r.h); } Rect rectB(Rect r) { ret rectFromPoints(r.x+half(r.w), r.y, r.x2(), r.y2()); } Rect rectC(Rect r) { ret rectFromPoints(r.x, r.y+half(r.h), r.x+half(r.w), r.y2()); } Rect rectD(Rect r) { ret rectFromPoints(r.x+half(r.w), r.y+half(r.h), r.x2(), r.y2()); } }