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


C++ Chart::build方法代码示例

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


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

示例1: extractCharts

void Atlas::extractCharts()
{
    const uint faceCount = m_mesh->faceCount();

    int first = 0;
    Array<uint> queue(faceCount);

    BitArray bitFlags(faceCount);
    bitFlags.clearAll();

    for (uint f = 0; f < faceCount; f++)
    {
        if (bitFlags.bitAt(f) == false)
        {
            // Start new patch. Reset queue.
            first = 0;
            queue.clear();
            queue.append(f);
            bitFlags.setBitAt(f);

            while (first != queue.count())
            {
                const HalfEdge::Face * face = m_mesh->faceAt(queue[first]);

                // Visit face neighbors of queue[first]
                for (HalfEdge::Face::ConstEdgeIterator it(face->edges()); !it.isDone(); it.advance())
                {
                    const HalfEdge::Edge * edge = it.current();
                    nvDebugCheck(edge->pair != NULL);

                    if (!edge->isBoundary() && /*!edge->isSeam()*/ 
                        //!(edge->from()->tex() != edge->pair()->to()->tex() || edge->to()->tex() != edge->pair()->from()->tex()))
                        !(edge->from() != edge->pair->to() || edge->to() != edge->pair->from())) // Preserve existing seams (not just texture seams).
                    {
                        const HalfEdge::Face * neighborFace = edge->pair->face;
                        nvDebugCheck(neighborFace != NULL);

                        if (bitFlags.bitAt(neighborFace->id) == false)
                        {
                            queue.append(neighborFace->id);
                            bitFlags.setBitAt(neighborFace->id);
                        }
                    }
                }

                first++;
            }

            Chart * chart = new Chart();
            chart->build(m_mesh, queue);

            m_chartArray.append(chart);
        }
    }
}
开发者ID:maleiwhat,项目名称:thekla_atlas,代码行数:55,代码来源:Atlas.cpp

示例2: computeCharts

void Atlas::computeCharts(const SegmentationSettings & settings)
{
    AtlasBuilder builder(m_mesh);

    // Tweak these values:
    const float maxThreshold = 2;
    const uint growFaceCount = 32;
    const uint maxIterations = 4;
    
    builder.settings = settings;

    //builder.settings.proxyFitMetricWeight *= 0.75; // relax proxy fit weight during initial seed placement.
    //builder.settings.roundnessMetricWeight = 0;
    //builder.settings.straightnessMetricWeight = 0;

    // This seems a reasonable estimate.
    uint maxSeedCount = max(6U, m_mesh->faceCount());

    // Create initial charts greedely.
    nvDebug("### Placing seeds\n");
    builder.placeSeeds(maxThreshold, maxSeedCount);
    nvDebug("###   Placed %d seeds (max = %d)\n", builder.chartCount(), maxSeedCount);

    builder.updateProxies();

    builder.mergeCharts();

#if 1
    nvDebug("### Relocating seeds\n");
    builder.relocateSeeds();

    nvDebug("### Reset charts\n");
    builder.resetCharts();

    builder.settings = settings;

    nvDebug("### Growing charts\n");

    // Restart process growing charts in parallel.
    uint iteration = 0;
    while (true)
    {
        if (!builder.growCharts(maxThreshold, growFaceCount))
        {
            nvDebug("### Can't grow anymore\n");

            // If charts cannot grow more: fill holes, merge charts, relocate seeds and start new iteration.

            nvDebug("### Filling holes\n");
            builder.fillHoles(maxThreshold);
            nvDebug("###   Using %d charts now\n", builder.chartCount());

            builder.updateProxies();

            nvDebug("### Merging charts\n");
            builder.mergeCharts();
            nvDebug("###   Using %d charts now\n", builder.chartCount());

            nvDebug("### Reseeding\n");
            if (!builder.relocateSeeds())
            {
                nvDebug("### Cannot relocate seeds anymore\n");

                // Done!
                break;
            }

            if (iteration == maxIterations)
            {
                nvDebug("### Reached iteration limit\n");
                break;
            }
            iteration++;

            nvDebug("### Reset charts\n");
            builder.resetCharts();

            nvDebug("### Growing charts\n");
        }
    };
#endif

    // Make sure no holes are left!
    nvDebugCheck(builder.facesLeft == 0);

    const uint chartCount = builder.chartArray.count();
    for (uint i = 0; i < chartCount; i++)
    {
        Chart * chart = new Chart();
        m_chartArray.append(chart);

        chart->build(m_mesh, builder.chartFaces(i));
    }

    // Build face indices.
    m_faceChart.resize(m_mesh->faceCount());
    m_faceIndex.resize(m_mesh->faceCount());

    for (uint i = 0; i < chartCount; i++)
    {
//.........这里部分代码省略.........
开发者ID:maleiwhat,项目名称:thekla_atlas,代码行数:101,代码来源:Atlas.cpp


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