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


C++ Box3::IncludeBox方法代码示例

本文整理汇总了C++中Box3::IncludeBox方法的典型用法代码示例。如果您正苦于以下问题:C++ Box3::IncludeBox方法的具体用法?C++ Box3::IncludeBox怎么用?C++ Box3::IncludeBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Box3的用法示例。


在下文中一共展示了Box3::IncludeBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BSPOperation

void BSPOctree::BSPOperation(BaseMesh *mesh1, BaseMesh *mesh2, BaseMesh** output)
{
    Box3 bbox = mesh1->AABB();
    bbox.IncludeBox(mesh2->AABB());

    NormalMesh *myMesh1 = new NormalMesh(mesh1), *myMesh2;

    if (FixedBSPTree::OP_DIFFERENCE == mOperation)
        myMesh2 = new NormalMesh(mesh2, NormalMesh::PARA_NEGATE);
    else myMesh2 = new NormalMesh(mesh2);

    myMesh1->NormalizeCoord(&bbox);
    myMesh1->FilterVertex(11);
    myMesh2->NormalizeCoord(&bbox);
    myMesh2->FilterVertex(11);
    
    normalizeBox3(mesh1->AABB(), bbox, mAABB1);
    normalizeBox3(mesh2->AABB(), bbox, mAABB2);
    staticFilterP(mAABB1, 11);
    staticFilterP(mAABB2, 11);

    auto t0 = clock();
    // initialize the para of the first cell
    PolygonPtrList pool1, pool2;
    GSOutputTimeLog(L"init: ");

    auto &ver1 = myMesh1->Vertex();
    auto &tri1 = myMesh1->Triangle();
    int i = 0;
    for (auto &titr: tri1)
    {
        mMesh1.emplace_back(ver1[titr[0]], ver1[titr[1]], ver1[titr[2]]);
        mMesh1.back().index = i;
        mMesh1.back().mpMesh = mesh1;
        mMesh1.back().mTriId = i;
        pool1.push_back(i++);
    }
    delete myMesh1;

    auto &ver2 = myMesh2->Vertex();
    auto &tri2 = myMesh2->Triangle();
    i = 0;
    for (auto &titr: tri2)
    {
        mMesh2.emplace_back(ver2[titr[0]], ver2[titr[1]], ver2[titr[2]]);
        mMesh2.back().mpMesh = mesh2;
        mMesh2.back().mTriId = i;
        pool2.push_back(i++);
    }
    delete myMesh2;

    for (auto &meshe: mMesh1) meshe.pMeshData = &meshe;
    for (auto &meshe: mMesh2) meshe.pMeshData = &meshe;

    Box3 initBox(Box3::BOX_MIRROR_SCALE);

    mesh1->NormalizeCoord(&bbox);
    mesh2->NormalizeCoord(&bbox);

    GSOutputTimeLog(L"start Iteration: ");
    PerformIteration(pool1, pool2, initBox, &mpRoot);

    if (*output) delete *output;
    auto &outputPtr = *output;

    GSOutputTimeLog(L"end Iteration: ");
    outputPtr = CollectPolygons(mesh1, mesh2);

    GSOutputTimeLog(L"end collection: ");
    mesh1->DenormalizeCoord();
    mesh2->DenormalizeCoord();
    outputPtr->DenormalizeCoord(&bbox);
    outputPtr->GenAABB(false);

    auto t1 = clock();
    long t = t1-t0;
    wchar_t ch[32];
    wsprintf(ch, L"time: %d\n", t);
    WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), ch, wcslen(ch), 0, 0);
}
开发者ID:RoyLab,项目名称:CSGBoolean,代码行数:80,代码来源:BSPOctTree.cpp


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