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


C++ HalfEdge::setFace方法代码示例

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


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

示例1: adicionaface

void Interface::adicionaface(HalfEdge* e, Face* f)
{
    HalfEdge *ori = e;
    HalfEdge *ant = NULL;
    HalfEdge *nova = NULL;
    HalfEdge *first;
    bool sai = false;

    nova = new HalfEdge();

    nova->setFace(f);
    nova->setTwin(ori);
    ori->setTwin(nova);
    nova->setOrigem(ori->getDestino());
    f->setOuterComp(nova);
    ant = nova;
    first = nova;

    ori = ori->getProx();
    while(true)
    {
        while(ori->getTwin() != NULL)
        {
            if(ori == e)
            {
                sai = true;
                break;
            }
            ori = ori->getTwin()->getProx();
        }

        if(sai)
            break;

        nova = new HalfEdge();

        nova->setFace(f);
        nova->setTwin(ori);
        ori->setTwin(nova);
        nova->setProx(ant);
        ant->setAnt(nova);
        nova->setOrigem(ori->getDestino());

        ori = ori->getProx();

        ant = nova;
    }

    ori->getTwin()->setProx(ant);
    ant->setAnt(ori->getTwin());
}
开发者ID:Mendelev,项目名称:cg-ufrj-2011,代码行数:51,代码来源:Interface.cpp

示例2: addFace

void Interface::addFace(QVector<QPointF> in)
{
    Face *f = new Face();
    HalfEdge *ant = NULL;
    HalfEdge *first, *twin, *temp;

    for(int i = 0; i < in.size(); i++)
    {
        HalfEdge *e = new HalfEdge();
        if (i == 0)     first = e;

        temp = findTwin(in[i],in[(i+1)%in.size()]);
        if (temp != NULL)
            e = temp;
        else
            map[qMakePair(in[i], in[(i+1)%in.size()])] = e;

        twin = e->getTwin();
        if (twin == NULL)
            twin = findTwin(in[(i+1)%in.size()],in[i]);


        minX = MIN(minX, in[i].x());
        maxX = MAX(maxX, in[i].x());
        minY = MIN(minY, in[i].y());
        maxY = MAX(maxY, in[i].y());

        Vertex *v = addVertex(in[i]);
        v->setEdge(e);
        e->setOrigem(v);

        e->setFace(f);

        e->setAnt(ant);
        if (ant!= NULL)
        {
            ant->setProx(e);
        }

        e->setTwin(twin);
        if (twin!= NULL)
        {
            twin->setTwin(e);
        }

        ant = e;
    }

    first->setAnt(ant);
    ant->setProx(first);

    f->setOuterComp(first);

    faces.push_back(f);
}
开发者ID:Mendelev,项目名称:cg-ufrj-2011,代码行数:55,代码来源:Interface.cpp

示例3: Face

Face <T> :: Face ( const Container <Node3DCartesian <T> *, destructable> &nl, Container <HalfEdge <T> *> &hl )
{
        //Create Face from the list of nodes
        this->vertices_count = nl.size();
        this->edge = NULL;

        //Nodes list contains some points
        if ( this->vertices_count > 2 )
        {
                //Create first half edge
                HalfEdge <T> *h = new HalfEdge <T> ( nl [0], NULL, NULL, NULL ); //Create first edge
                HalfEdge <T> *h_start = h;
                hl.push_back ( h );

                //Create other half edges
                HalfEdge <T> *h_old = h;

                //Process all vertices
                for ( unsigned int i = 1; i < this->vertices_count; i++, h_old = h )
                {
                        //Create new edge and set previous edge
                        h = new HalfEdge <T> ( nl [i], h_old, NULL, NULL );

                        //Set next edge
                        h_old->setNextEdge ( h );

                        //Set face for each edge
                        h->setFace ( this );

                        //Add half edge to the list
                        hl.push_back ( h );
                }

                //Set previous edge of the first edge
                h_start->setPreviousEdge ( h );

                //Set next edge for the last edge
                h->setNextEdge ( h_start );

                //Set face for h start
                h_start->setFace ( this );

                //Set start edge of the Face
                this->edge = h_start;
        }
}
开发者ID:bayertom,项目名称:detectproj,代码行数:46,代码来源:Face.hpp


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