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


C++ halfedge::Vertex类代码示例

本文整理汇总了C++中halfedge::Vertex的典型用法代码示例。如果您正苦于以下问题:C++ Vertex类的具体用法?C++ Vertex怎么用?C++ Vertex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: computeCircularBoundaryMap

bool nv::computeCircularBoundaryMap(HalfEdge::Mesh * mesh)
{
    HalfEdge::Vertex * vertex = findBoundaryVertex(mesh);

    if (vertex == NULL)
    {
        return false;
    }

    // Compute boundary length.
    float boundaryLength = 0.0f;

    HalfEdge::Edge * const firstEdge = vertex->edge();
    HalfEdge::Edge * edge = firstEdge;
    do {
        boundaryLength += edge->length();
        edge = edge->next();
    } while (edge != firstEdge);

    float length = 0.0f;

    edge = firstEdge;
    do {
        float angle = length * 2.0f * PI / boundaryLength;
        edge->vertex()->tex.set(cos(angle), sin(angle));

		length += edge->length();
        edge = edge->next();
    } while (edge != firstEdge);

    return true;
}
开发者ID:Thekla,项目名称:thekla_atlas,代码行数:32,代码来源:BoundaryMap.cpp

示例2: adjustSeamTexCoords

void nv::adjustSeamTexCoords(HalfEdge::Mesh * mesh, int width, int height, float offset)
{
	// Quantize seam texture coordinates.
	const uint vertexCount = mesh->vertexCount();
	for(uint v = 0; v < vertexCount; v++)
	{
		HalfEdge::Vertex * vertex =  mesh->vertexAt(v);
	
		const uint colocalCount = vertex->colocalCount();
		if (colocalCount > 1)
		{
			vertex->setTex(roundToTexelCenter(vertex->tex(), width, height, offset));
		}
	}
}
开发者ID:DanielGeorge,项目名称:nvidia-mesh-tools,代码行数:15,代码来源:Seams.cpp

示例3: closeHoles

bool Chart::closeHoles()
{
    Array<HalfEdge::Edge *> boundaryEdges;
    getBoundaryEdges(m_unifiedMesh.ptr(), boundaryEdges);

    uint boundaryCount = boundaryEdges.count();
    if (boundaryCount <= 1)
    {
        // Nothing to close.
        return true;
    }

    // Compute lengths and areas.
    Array<float> boundaryLengths;
    //Array<Vector3> boundaryCentroids;

    for (uint i = 0; i < boundaryCount; i++)
    {
        const HalfEdge::Edge * startEdge = boundaryEdges[i];
        nvCheck(startEdge->face == NULL);

        //float boundaryEdgeCount = 0;
        float boundaryLength = 0.0f;
        //Vector3 boundaryCentroid(zero);

        const HalfEdge::Edge * edge = startEdge;
        do {
            Vector3 t0 = edge->from()->pos;
            Vector3 t1 = edge->to()->pos;

            //boundaryEdgeCount++;
            boundaryLength += length(t1 - t0);
            //boundaryCentroid += edge->vertex()->pos;

            edge = edge->next;
        } while(edge != startEdge);

        boundaryLengths.append(boundaryLength);
        //boundaryCentroids.append(boundaryCentroid / boundaryEdgeCount);
    }


    // Find disk boundary.
    uint diskBoundary = 0;
    float maxLength = boundaryLengths[0];

    for (uint i = 1; i < boundaryCount; i++)
    {
        if (boundaryLengths[i] > maxLength)
        {
            maxLength = boundaryLengths[i];
            diskBoundary = i;
        }
    }


    // Sew holes.
    /*for (uint i = 0; i < boundaryCount; i++)
    {
        if (diskBoundary == i)
        {
            // Skip disk boundary.
            continue;
        }

        HalfEdge::Edge * startEdge = boundaryEdges[i];
        nvCheck(startEdge->face() == NULL);

        boundaryEdges[i] = m_unifiedMesh->sewBoundary(startEdge);
    }

    exportMesh(m_unifiedMesh.ptr(), "debug_sewn.obj");*/

    //bool hasNewHoles = false;

    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // @@ Close loop is wrong, after closing a loop, we do not only have to add the face, but make sure that every edge in he loop is pointing to the right place.

    // Close holes.
    for (uint i = 0; i < boundaryCount; i++)
    {
        if (diskBoundary == i)
        {
            // Skip disk boundary.
            continue;
        }

        HalfEdge::Edge * startEdge = boundaryEdges[i];
        nvDebugCheck(startEdge != NULL);
        nvDebugCheck(startEdge->face == NULL);

#if 1
        Array<HalfEdge::Vertex *> vertexLoop;
        Array<HalfEdge::Edge *> edgeLoop;

        HalfEdge::Edge * edge = startEdge;
        do {
            HalfEdge::Vertex * vertex = edge->next->vertex; // edge->to()

            uint i;
//.........这里部分代码省略.........
开发者ID:maleiwhat,项目名称:thekla_atlas,代码行数:101,代码来源:Atlas.cpp


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