DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
tests
io
writers
testMeshWriter.cpp
1
30
31
#include <iostream>
32
#include "DGtal/base/Common.h"
33
#include "DGtal/helpers/StdDefs.h"
35
#include "DGtal/shapes/fromPoints/MeshFromPoints.h"
36
#include "DGtal/io/writers/MeshWriter.h"
39
40
using namespace
std;
41
using namespace
DGtal;
42
using namespace
Z3i;
43
45
// Functions for testing class MeshWriter.
47
48
53
bool
testMeshWriter()
54
{
55
unsigned
int
nbok = 0;
56
unsigned
int
nb = 0;
58
// Constructing the mesh to export in OFF format
59
MeshFromPoints<Point>
aMesh(
true
);
60
vector<Point> vectVertex;
61
Point
p1(0, 0, 0);
62
Point
p2(1, 0, 0);
63
Point
p3(1, 1, 0);
64
Point
p4(0, 1, 0);
65
aMesh.addVertex(p1);
66
aMesh.addVertex(p2);
67
aMesh.addVertex(p3);
68
aMesh.addVertex(p4);
69
70
vector<DGtal::Color> vectColor;
71
DGtal::Color
col (250,0,0, 200);
72
aMesh.addQuadFace(0,1,2,3, col);
75
bool
isOK = aMesh >>
"test.off"
;
77
nb++;
78
bool
isOK2 = aMesh >>
"test.obj"
;
79
nb++;
80
81
trace
.
beginBlock
(
"Testing block ..."
);
82
nbok += isOK ? 1 : 0;
83
nbok += isOK2 ? 1 : 0;
84
85
86
trace
.
info
() <<
"("
<< nbok <<
"/"
<< nb <<
") "
87
<<
"true == true"
<< std::endl;
88
trace
.
endBlock
();
89
return
nbok == nb;
90
}
91
93
// Standard services - public :
94
95
int
main(
int
argc,
char
** argv )
96
{
97
trace
.
beginBlock
(
"Testing class MeshWriter"
);
98
trace
.
info
() <<
"Args:"
;
99
for
(
int
i = 0; i < argc; ++i )
100
trace
.
info
() <<
" "
<< argv[ i ];
101
trace
.
info
() << endl;
102
103
bool
res = testMeshWriter();
// && ... other tests
104
trace
.
emphase
() << ( res ?
"Passed."
:
"Error."
) << endl;
105
trace
.
endBlock
();
106
return
res ? 0 : 1;
107
}
108
// //
110
111
Generated on Wed Dec 19 2012 19:10:41 for DGtal by
1.8.1.1