⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parameterization_polyhedron_adaptor_ex.h

📁 很多二维 三维几何计算算法 C++ 类库
💻 H
📖 第 1 页 / 共 3 页
字号:
        CGAL_For_all(pHalfedge,end) {            if(pHalfedge->is_border()) {                seed_halfedge = pHalfedge;                break;            }        }        // if inner vertex        if (seed_halfedge == NULL)            return border;                  // return empty list        // Add seed vertex        border.push_back(seed_vertex);        // fill border        Halfedge_handle current_halfedge = seed_halfedge;        do        {            // Stop if end of loop            Halfedge_handle next_halfedge = current_halfedge->next();            Vertex_handle next_vertex = next_halfedge->vertex();            if(next_vertex == seed_vertex)                break;            // Add vertex            border.push_back(next_vertex);            current_halfedge = next_halfedge;        }        while(1);        return border;    }    // Get iterator over first facet of mesh    Facet_iterator  mesh_facets_begin() {        return m_polyhedron.facets_begin();    }    Facet_const_iterator  mesh_facets_begin() const {        return m_polyhedron.facets_begin();    }    // Get iterator over past-the-end facet of mesh    Facet_iterator  mesh_facets_end() {        return m_polyhedron.facets_end();    }    Facet_const_iterator  mesh_facets_end() const {        return m_polyhedron.facets_end();    }    // Count the number of facets of the mesh    int  count_mesh_facets() const {        int index = 0;        for (Facet_const_iterator it=mesh_facets_begin(); it!=mesh_facets_end(); it++)            index++;        return index;    }    // Return true of all mesh's facets are triangles    bool  is_mesh_triangular() const {        for (Facet_const_iterator it = mesh_facets_begin(); it != mesh_facets_end(); it++)            if (count_facet_vertices(it) != 3)                return false;        return true;            // mesh is triangular if we reach this point    }    // Count the number of halfedges of the mesh    int  count_mesh_halfedges() const {        int index = 0;        for (Halfedge_iterator pHalfedge = m_polyhedron.halfedges_begin();             pHalfedge != m_polyhedron.halfedges_end();             pHalfedge++)        {            index++;        }        return index;    }    // FACET INTERFACE    // Get circulator over facet's vertices    Vertex_around_facet_circulator  facet_vertices_begin(Facet_handle facet) {        return Vertex_around_facet_circulator(facet->facet_begin());    }    Vertex_around_facet_const_circulator  facet_vertices_begin(Facet_const_handle facet) const {        return Vertex_around_facet_const_circulator(facet->facet_begin());    }    // Count the number of vertices of a facet    int  count_facet_vertices(Facet_const_handle facet) const {        int index = 0;        Vertex_around_facet_const_circulator cir     = facet_vertices_begin(facet),                                             cir_end = cir;        CGAL_For_all(cir, cir_end)            index++;        return index;    }    // VERTEX INTERFACE    // Get the 3D position of a vertex    Point_3 get_vertex_position(Vertex_const_handle vertex) const {        return vertex->point();    }    // Get/set the 2D position (u/v pair) of a vertex. Default value is undefined.    // (stored in halfedges sharing the same vertex)    Point_2  get_vertex_uv(Vertex_const_handle vertex) const {        return get_corners_uv(vertex, NULL, NULL);    }    void  set_vertex_uv(Vertex_handle vertex, const Point_2& uv) {        set_corners_uv(vertex, NULL, NULL, uv);    }    // Get/set "is parameterized" field of vertex. Default value is undefined.    // (stored in halfedges sharing the same vertex)    bool  is_vertex_parameterized(Vertex_const_handle vertex) const {        return are_corners_parameterized(vertex, NULL, NULL);    }    void  set_vertex_parameterized(Vertex_handle vertex, bool parameterized) {        set_corners_parameterized(vertex, NULL, NULL, parameterized);    }    // Get/set vertex index. Default value is undefined.    // (stored in Polyhedron vertex for debugging purpose)    int  get_vertex_index(Vertex_const_handle vertex) const {        //return get_corners_index(vertex, NULL, NULL);        return vertex->index();    }    void  set_vertex_index(Vertex_handle vertex, int index)    {        //set_corners_index(vertex, NULL, NULL, index);        vertex->index(index);    }    // Get/set vertex' all purpose tag. Default value is undefined.    // (stored in halfedges sharing the same vertex)    int  get_vertex_tag(Vertex_const_handle vertex) const {        return get_corners_tag(vertex, NULL, NULL);    }    void set_vertex_tag(Vertex_handle vertex, int tag) {        set_corners_tag(vertex, NULL, NULL, tag);    }    // Return true if a vertex belongs to ANY mesh's border    bool  is_vertex_on_border(Vertex_const_handle vertex) const {        return m_polyhedron.is_border(vertex);    }    // Return true if a vertex belongs to the UNIQUE mesh's main border,    // i.e. the mesh's LONGEST border    bool  is_vertex_on_main_border(Vertex_const_handle vertex) const {        return std::find(m_main_border.begin(),                         m_main_border.end(),                         (Vertex*)&*vertex) != m_main_border.end();    }    // Get circulator over the vertices incident to 'vertex'    // 'start_position' defines the optional initial position of the circulator    Vertex_around_vertex_circulator vertices_around_vertex_begin(                            Vertex_handle vertex,                            Vertex_handle start_position = Vertex_handle())    {        if (start_position == NULL)            return Vertex_around_vertex_circulator(vertex->vertex_begin());        else            return Vertex_around_vertex_circulator(            		Halfedge_around_vertex_circulator(                        	get_halfedge(start_position, vertex)));    }    Vertex_around_vertex_const_circulator vertices_around_vertex_begin(                            Vertex_const_handle vertex,                            Vertex_const_handle start_position = Vertex_const_handle()) const    {        if (start_position == NULL)            return Vertex_around_vertex_const_circulator(vertex->vertex_begin());        else            return Vertex_around_vertex_const_circulator(            		Halfedge_around_vertex_const_circulator(                        	get_halfedge(start_position, vertex)));    }    //******************************************************************    // LEVEL 2 INTERFACE:    // for classes that deal with virtual seams    // Example: Parameterization_mesh_patch_3    //******************************************************************    // VERTEX INTERFACE    // Get/set vertex seaming flag. Default value is undefined.    int  get_vertex_seaming(Vertex_const_handle vertex) const {        return vertex->seaming();    }    void set_vertex_seaming(Vertex_handle vertex, int seaming) {        vertex->seaming(seaming);    }    // EDGE INTERFACE    // Get/set oriented edge's seaming flag, i.e. position of the oriented edge    // w.r.t. to the UNIQUE main border    int  get_halfedge_seaming(Vertex_const_handle source, Vertex_const_handle target) const {        return get_halfedge(source, target)->seaming();    }    void set_halfedge_seaming(Vertex_handle source, Vertex_handle target, int seaming) {        get_halfedge(source, target)->seaming(seaming);    }    // CORNER INTERFACE    // Get/set the 2D position (= (u,v) pair) of corners at the "right"    // of the prev_vertex -> vertex -> next_vertex line.    // Default value is undefined.    // (stored in incident halfedges)    Point_2 get_corners_uv(Vertex_const_handle vertex,                           Vertex_const_handle prev_vertex,                           Vertex_const_handle next_vertex) const    {        // if inner vertex        if (prev_vertex == NULL && next_vertex == NULL)        {            // get (u,v) pair from any incident halfedge            return Point_2(vertex->halfedge()->u(), vertex->halfedge()->v());        }        else // if seam vertex        {            assert(prev_vertex != NULL);            assert(next_vertex != NULL);            // get (u,v) pair from first inner halfedge (clockwise)            Halfedge_around_vertex_const_circulator cir(                                get_halfedge(next_vertex, vertex) );            return Point_2(cir->u(), cir->v());        }    }    void set_corners_uv(Vertex_handle vertex,                        Vertex_const_handle prev_vertex,                        Vertex_const_handle next_vertex,                        const Point_2& uv)    {        // if inner vertex        if (prev_vertex == NULL && next_vertex == NULL)        {            // Loop over all incident halfedges            Halfedge_around_vertex_circulator cir     = vertex->vertex_begin(),                                              cir_end = cir;            CGAL_For_all(cir, cir_end)                cir->uv(uv.x(), uv.y());        }        else // if seam vertex        {            assert(prev_vertex != NULL);            assert(next_vertex != NULL);            // first inner halfedge (for a clockwise rotation)            Halfedge_around_vertex_circulator cir(                                get_halfedge((Vertex*)&*next_vertex, vertex) );            // past-the-end inner halfedge (for a clockwise rotation)            Halfedge_around_vertex_circulator cir_end(                                get_halfedge((Vertex*)&*prev_vertex, vertex) );            // Loop over incident halfedges at the "right"            // of the prev_vertex -> vertex -> next_vertex line            CGAL_For_all(cir, cir_end)                cir->uv(uv.x(), uv.y());        }    }    // Get/set "is parameterized" field of corners at the "right"    // of the prev_vertex -> vertex -> next_vertex line.    // Default value is undefined.    // (stored in incident halfedges)    bool are_corners_parameterized(Vertex_const_handle vertex,                                   Vertex_const_handle prev_vertex,                                   Vertex_const_handle next_vertex) const    {        // if inner vertex        if (prev_vertex == NULL && next_vertex == NULL)        {            // get "is parameterized" field from any incident halfedge            return vertex->halfedge()->is_parameterized();        }        else // if seam vertex        {            assert(prev_vertex != NULL);            assert(next_vertex != NULL);            // get "is parameterized" field from first inner halfedge (clockwise)            Halfedge_around_vertex_const_circulator cir(                                get_halfedge(next_vertex, vertex) );            return cir->is_parameterized();        }    }    void set_corners_parameterized(Vertex_handle vertex,                                   Vertex_const_handle prev_vertex,                                   Vertex_const_handle next_vertex,                                   bool parameterized)    {        // if inner vertex

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -