vcglib/apps/sample/trimesh_pos_demo/trimesh_pos_demo.cpp

56 lines
1.4 KiB
C++
Raw Normal View History

2008-05-06 17:07:57 +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:07:57 +02:00
#include <vcg/complex/trimesh/base.h>
#include<vcg/complex/trimesh/create/platonic.h>
2008-05-06 17:56:29 +02:00
#include<vcg/complex/trimesh/update/topology.h>
2008-05-06 17:07:57 +02:00
#include <vcg/simplex/face/pos.h>
class MyEdge;
class MyFace;
class MyVertex: public vcg::VertexSimp2<MyVertex,MyEdge,MyFace, vcg::vert::Coord3d, vcg::vert::Normal3f>{};
class MyFace: public vcg::FaceSimp2<MyVertex,MyEdge,MyFace, vcg::face::VertexRef,vcg::face::FFAdj>{};
class MyMesh: public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> > {};
void OneRingNeighborhood( MyFace * f)
{
MyVertex * v = f->V(0);
MyFace* start = f;
2008-05-06 17:38:48 +02:00
vcg::face::Pos<MyFace> p(f,0,v);// constructor that takes face, edge and vertex
2008-05-06 17:07:57 +02:00
do
{
p.FlipF();
p.FlipE();
}while(p.f!=start);
}
2008-05-06 17:38:48 +02:00
#include <vcg/simplex/face/jumping_pos.h> // include the definition of jumping pos
void OneRingNeighborhoodJP( MyFace * f)
{
MyVertex * v = f->V(0);
MyFace* start = f;
vcg::face::JumpingPos<MyFace> p(f,0,v);// constructor that takes face, edge and vertex
do
{
p.NextFE();
}while(p.f!=start);
}
2008-05-06 17:07:57 +02:00
int main()
{
MyMesh m;
vcg::tri::Tetrahedron(m);
2008-05-06 18:05:20 +02:00
vcg::tri::UpdateTopology<MyVCGMesh>::FaceFace(m);
2008-05-06 17:07:57 +02:00
OneRingNeighborhood(&(*m.face.begin()));
2008-05-06 17:38:48 +02:00
OneRingNeighborhoodJP(&(*m.face.begin()));
2008-05-06 17:07:57 +02:00
return 0;
}