DGtal 1.4.2
Loading...
Searching...
No Matches
testBall3DSurface.cpp File Reference
#include <iostream>
#include "DGtal/shapes/parametric/Ball3D.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/Color.h"
Include dependency graph for testBall3DSurface.cpp:

Go to the source code of this file.

Functions

int main (int, char **)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Anis Benyoub (anis..nosp@m.beny.nosp@m.oub@i.nosp@m.nsa-.nosp@m.lyon..nosp@m.fr )
Date
2012/°6/05

Functions for testing class Ball3D.

This file is part of the DGtal library.

Definition in file testBall3DSurface.cpp.

Function Documentation

◆ main()

int main ( int ,
char **  )

Definition at line 45 of file testBall3DSurface.cpp.

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 }
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 }
89
90
91 if (test)
92 return 0;
93 else
94 return -1;
95}
Aim: Model of the concept StarShaped3D represents any Sphere in the space.
Definition Ball3D.h:61
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
Trace trace
Definition Common.h:153
bool test(const I &itb, const I &ite)

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), test(), and DGtal::trace.