当前位置: 首页>>代码示例>>C++>>正文


C++ BBox::includes方法代码示例

本文整理汇总了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;
                    }
                }
        }
}
开发者ID:SupaYoshi,项目名称:pigmap,代码行数:34,代码来源:pigmap.cpp


注:本文中的BBox::includes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。