vcglib/apps/sample/trimesh_pos_demo/trimesh_vfiter_demo.cpp

39 lines
1.1 KiB
C++
Raw Normal View History

2008-05-06 17:57:17 +02:00
#include <vector>
#include <vcg/simplex/vertex/base.h>
#include <vcg/simplex/vertex/component.h>
#include <vcg/simplex/face/base.h>
#include <vcg/simplex/face/component.h>
2008-05-06 17:57:17 +02:00
#include <vcg/complex/trimesh/base.h>
#include<vcg/complex/trimesh/create/platonic.h>
#include<vcg/complex/trimesh/update/topology.h>
#include <vcg/simplex/face/pos.h>
class MyEdge;
class MyFace;
class MyVertex: public vcg::VertexSimp2<MyVertex,MyEdge,MyFace, vcg::vert::Coord3d, vcg::vert::Normal3f,vcg::vert::VFAdj>{};
class MyFace: public vcg::FaceSimp2<MyVertex,MyEdge,MyFace, vcg::face::VertexRef,vcg::face::VFAdj>{};
class MyMesh: public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};
void OneRingNeighborhoodVF( MyVertex * v)
{
vcg::face::VFIterator<MyFace> vfi(v); //initialize the iterator tohe first face
for(;!vfi.End();++vfi)
{
MyFace* f = vfi.F();
// ...do something with face f
}
}
int main()
{
MyMesh m;
vcg::tri::Tetrahedron(m);
2008-05-06 18:05:20 +02:00
vcg::tri::UpdateTopology<MyVCGMesh>::VertexFace(m);
2008-05-06 17:57:17 +02:00
OneRingNeighborhoodVF(&(*m.vert.begin()));
return 0;
}