opengl - Why the surface parameterization failed? -


i want map 3d mesh disc, turns out several vertices on boundary connected inappropriately. probabaly there wrong sequence of vertices on boundary when stored ,but can't find figure out how.

here code how store vertices on boundary vector.

  1. find vertex on boundary , store start_vertex
  2. iterate halfedgess around vertex , find 1 on boundary, store , vertex points to
  3. loop until vertex pointed last halfedge equals start_vertex.

with steps, think fine, can't right result.

the original 3d mesh the original 3d mesh
result the result

void renderingwidget::calctexcoord() {     vector<openmesh::vertexhandle> boundary_vertex;     vector<openmesh::vertexhandle>::iterator bound_v_iter;     vector<openmesh::halfedgehandle> boundary_halfedges;     vector<openmesh::halfedgehandle>::iterator bound_he_iter;     vector<double> sum_distance;     vector<double>::iterator sum_iter;     sparsematrix<double> a(m_mesh.n_vertices(),m_mesh.n_vertices());     sparsematrix<double> b(m_mesh.n_vertices(),3);     solution_x.resize(m_mesh.n_vertices(),3);   //solve:a*x=b     bicgstab<sparsematrix<double>> solver; //  spqr<sparsematrix<double>> solver;     openmesh::vertexhandle boundary_;     openmesh::vertexhandle start_vertex;     openmesh::vertexhandle from_vertex;     openmesh::vertexhandle to_vertex;     mymesh::point from_point;     mymesh::point to_point;     double v_distance;     double sum_dis;     double he_dis;     double pi = acos(-1.0);     int num_bound=0;      //********find vertex on boundary start_vertex********//     (auto v_it=m_mesh.vertices_begin();v_it!=m_mesh.vertices_end();++v_it)     {         if (m_mesh.is_boundary(v_it.handle()))         {             boundary_ = v_it.handle();             start_vertex = v_it.handle();             boundary_vertex.push_back(boundary_);             break;         }     }      //********store halfedge on boundary , vertex points to********//          {         (mymesh::vertexohalfedgecwiter voh_it=m_mesh.voh_cwbegin(boundary_);voh_it!=m_mesh.voh_cwend(boundary_);++voh_it)         {             if (m_mesh.is_boundary(*voh_it))             {                 to_vertex = m_mesh.to_vertex_handle(*voh_it);                 boundary_halfedges.push_back(*voh_it);                 boundary_vertex.push_back(to_vertex);                 boundary_ = to_vertex;                 break;             }         }     } while (to_vertex!=start_vertex); 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -