// warning: slow void testTileBBoxes(const MapParams& mp) { // check tile bounding boxes for a few tiles for (int64_t tx = -5; tx <= 5; tx++) for (int64_t ty = -5; ty <= 5; ty++) { // get computed BBox TileIdx ti(tx,ty); BBox bbox = ti.getBBox(mp); // this is what the box is supposed to be int64_t xmin = 64*mp.B*mp.T*tx - 2*mp.B; int64_t ymax = 64*mp.B*mp.T*ty + 17*mp.B; int64_t xmax = xmin + mp.tileSize(); int64_t ymin = ymax - mp.tileSize(); // test pixels for (int64_t x = xmin - 15; x <= xmax + 15; x++) for (int64_t y = ymin - 15; y <= ymax + 15; y++) { bool result = bbox.includes(Pixel(x,y)); bool expected = x >= xmin && x < xmax && y >= ymin && y < ymax; if (result != expected) { cout << "failed tile bounding box test! " << tx << " " << ty << endl; cout << "[" << bbox.topLeft.x << "," << bbox.topLeft.y << "] to [" << bbox.bottomRight.x << "," << bbox.bottomRight.y << "]" << endl; cout << "[" << xmin << "," << ymin << "] to [" << xmax << "," << ymax << "]" << endl; cout << x << "," << y << endl; return; } } } }