本文整理汇总了C++中BBox::includes方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::includes方法的具体用法?C++ BBox::includes怎么用?C++ BBox::includes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::includes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testTileBBoxes
// 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;
}
}
}
}