DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testBall3DSurface.cpp
Go to the documentation of this file.
1
16
28
30
31
#include <iostream>
32
#include "DGtal/shapes/parametric/Ball3D.h"
33
#include "DGtal/helpers/StdDefs.h"
34
#include "DGtal/io/Color.h"
36
37
using namespace
std
;
38
using namespace
DGtal
;
39
using namespace
Z3i
;
40
42
// Standard services - public :
43
44
45
int
main
(
int
/*argc*/
,
char
**
/*argv*/
)
46
{
47
48
49
50
// -------------------------------------------------------------------------- Type declaring
51
typedef
Ball3D<Space>
EuclideanShape;
52
53
bool
test
=
true
;
54
55
// -------------------------------------------------------------------------- Creating the shape
56
double
radius = 10;
57
RealPoint
c1(0, 0, 0 );
58
EuclideanShape ball1( c1, radius );
59
60
trace
.
beginBlock
(
"Arc length computing"
);
61
double
arcExp = ball1.arclength( make_pair(0.0,0.0), make_pair(0.0,M_PI) ,500 );
62
double
arcTheo = M_PI*radius;
63
trace
.
info
() <<
"Computed arc length: "
<< arcExp <<endl;
64
trace
.
info
() <<
"Theoric arc length: "
<< arcTheo << endl;
65
if
(fabs(arcTheo- arcExp) < 0.1)
66
{
67
trace
.
info
() <<
"The arc length has a good value"
<<endl;
68
}
69
else
70
{
71
test
=
false
;
72
}
73
trace
.
endBlock
();
74
75
trace
.
beginBlock
(
"Surface length computing"
);
76
double
surfaceExp = ball1.surfacelength( make_pair(0.0,0.0), make_pair(M_PI*2,M_PI) ,500 );
77
double
surfaceTheo = 4.0*M_PI*radius*radius;
78
trace
.
info
() <<
"Computed surface length: "
<< surfaceExp <<endl;
79
trace
.
info
() <<
"Theoric surface length: "
<< surfaceTheo << endl;
80
if
(fabs(surfaceExp- surfaceTheo) < 0.1)
81
{
82
trace
.
info
() <<
"The surface has a good value"
<<endl;
83
}
84
else
85
{
86
test
=
false
;
87
}
88
trace
.
endBlock
();
89
90
91
if
(
test
)
92
return
0;
93
else
94
return
-1;
95
}
96
// //
DGtal::Ball3D
Aim: Model of the concept StarShaped3D represents any Sphere in the space.
Definition
Ball3D.h:61
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::info
std::ostream & info()
DGtal::Trace::endBlock
double endBlock()
DGtal::Z3i
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal::Z3i::RealPoint
Space::RealPoint RealPoint
Definition
StdDefs.h:170
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
test
bool test(const I &itb, const I &ite)
Definition
testMostCenteredMSEstimator.cpp:71
tests
shapes
testBall3DSurface.cpp
Generated on
for DGtal by
1.18.0