网站开发的心得,做电影网站还能赚钱吗,2017年做哪个网站致富,天津做小程序公司简介 查找一个顶点的一层领域边 代码一 这个代码使用了太多的auto#xff0c;其实不利于阅读#xff0c;代码二#xff0c;把auto更改了。 #include iostream
#include vector
// -------------------- OpenMesh
using namespace std;
#include OpenMes… 简介 查找一个顶点的一层领域边 代码一 这个代码使用了太多的auto其实不利于阅读代码二把auto更改了。 #include iostream
#include vector
// -------------------- OpenMesh
using namespace std;
#include OpenMesh/Core/IO/MeshIO.hh
#include OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh
typedef OpenMesh::TriMesh_ArrayKernelTMyMesh;int main()
{MyMesh mesh;// read mesh from stdinint a, x0, y0;if (!OpenMesh::IO::read_mesh(mesh, output8.off)){cerr Error: cannot write mesh to endl;return 1;}cout 请输入您要查找邻域的顶点坐标: endl;cout x; cin x0;cout y; cin y0;for (MyMesh::VertexIter v_it mesh.vertices_begin(); v_it ! mesh.vertices_end(); v_it){// circulate around the current vertex auto point mesh.point(*v_it);if (point.data()[0] x0 point.data()[1] y0)//找到对应的点for (auto vh_it mesh.voh_begin(*v_it); vh_it ! mesh.voh_end(*v_it); vh_it) // 半边迭代器{auto h mesh.next_halfedge_handle(*vh_it);// 这个顶点的下一条半边auto to_v mesh.to_vertex_handle(h);// 下一条半边相对的点(handle)auto from_v mesh.from_vertex_handle(h);// 下一条半边开始的点(handle)auto topoint mesh.point(to_v);// 把handle转换为点的结构返回出去auto frompoint mesh.point(from_v);// 同上cout 邻域边两端顶点1坐标x: frompoint.data()[0] y: frompoint.data()[1] z: frompoint.data()[2] endl;cout 邻域边两端顶点2坐标x: topoint.data()[0] y: topoint.data()[1] z: topoint.data()[2] endl;cout \n endl;}else continue;}cin a;// write mesh to stdoutif (!OpenMesh::IO::write_mesh(mesh, output9.off)){cerr Error: cannot write mesh to endl;return 1;}return 0;
} 代码二 #include iostream
#include vector
// -------------------- OpenMesh
using namespace std;
#include OpenMesh/Core/IO/MeshIO.hh
#include OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh
typedef OpenMesh::TriMesh_ArrayKernelTMyMesh;int main()
{MyMesh mesh;// read mesh from stdinint a, x0, y0;if (!OpenMesh::IO::read_mesh(mesh, output8.off)){cerr Error: cannot write mesh to endl;return 1;}cout 请输入您要查找邻域的顶点坐标: endl;cout x; cin x0;cout y; cin y0;for (MyMesh::VertexIter v_it mesh.vertices_begin(); v_it ! mesh.vertices_end(); v_it){// circulate around the current vertex OpenMesh::Vec3f point mesh.point(*v_it);if (point.data()[0] x0 point.data()[1] y0)//找到对应的点for (auto vh_it mesh.voh_begin(*v_it); vh_it ! mesh.voh_end(*v_it); vh_it) // 半边迭代器{auto h mesh.next_halfedge_handle(*vh_it);// 这个顶点的下一条半边OpenMesh::ArrayKernel::VertexHandle to_v mesh.to_vertex_handle(h);// 下一条半边相对的点(handle)OpenMesh::ArrayKernel::VertexHandle from_v mesh.from_vertex_handle(h);// 下一条半边开始的点(handle)OpenMesh::Vec3f topoint mesh.point(to_v);// 把handle转换为点的结构返回出去OpenMesh::Vec3f frompoint mesh.point(from_v);// 同上cout 邻域边两端顶点1坐标x: frompoint.data()[0] y: frompoint.data()[1] z: frompoint.data()[2] endl;cout 邻域边两端顶点2坐标x: topoint.data()[0] y: topoint.data()[1] z: topoint.data()[2] endl;cout \n endl;}else continue;}cin a;// write mesh to stdoutif (!OpenMesh::IO::write_mesh(mesh, output9.off)){cerr Error: cannot write mesh to endl;return 1;}return 0;
} 转载于:https://www.cnblogs.com/eat-too-much/p/11157035.html