File: trimesh_pos_demo.cpp

package info (click to toggle)
meshlab 1.3.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 20,900 kB
  • ctags: 33,325
  • sloc: cpp: 224,813; ansic: 8,170; xml: 119; makefile: 78
file content (56 lines) | stat: -rw-r--r-- 1,423 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#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>   

#include <vcg/complex/complex.h>   
#include<vcg/complex/algorithms/create/platonic.h>

#include<vcg/complex/algorithms/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>{};
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;
	vcg::face::Pos<MyFace> p(f,0,v);// constructor that takes face, edge and vertex
	do
	{
		p.FlipF();
		p.FlipE();
	}while(p.f!=start);
}

#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);
}

int main()
{
	MyMesh m;
	vcg::tri::Tetrahedron(m);
	vcg::tri::UpdateTopology<MyVCGMesh>::FaceFace(m);
	OneRingNeighborhood(&(*m.face.begin()));
	OneRingNeighborhoodJP(&(*m.face.begin()));
	return 0;
}