diff --git a/vcg/complex/algorithms/mesh_to_matrix.h b/vcg/complex/algorithms/mesh_to_matrix.h index 986cc9f6..d1240216 100644 --- a/vcg/complex/algorithms/mesh_to_matrix.h +++ b/vcg/complex/algorithms/mesh_to_matrix.h @@ -202,6 +202,22 @@ public: } } + static void GetUVData(const MeshType &mesh, + MatrixXm & uv) + { + tri::RequireVertexCompactness(mesh); + tri::RequirePerVertexTexCoord(mesh); + + uv = MatrixXm(mesh.VN(), 2); + + // per vertices uv + for (int i = 0; i < mesh.VN(); i++) + { + uv(i,0) = mesh.vert[i].cT().U(); + uv(i,1) = mesh.vert[i].cT().V(); + } + } + // get edge to face and edge to vertex adjacency static void GetTriEdgeAdjacency(const MeshType &mesh, Eigen::MatrixXi& EV,