• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VertexAnimationTrack类代码示例发布时间:2022-05-31
下一篇:
C++ VersionType类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap