DGtal  1.4.beta
testBallQuad.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "ConfigTest.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/topology/ImplicitDigitalSurface.h"
#include "DGtal/io/boards/Board3D.h"
Include dependency graph for testBallQuad.cpp:

Go to the source code of this file.

Functions

bool testBallQuad ()
 
int main (int argc, char **argv)
 

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
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systemes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2014/04/14

Functions for testing class BallQuad.

This file is part of the DGtal library.

Definition in file testBallQuad.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 121 of file testBallQuad.cpp.

122 {
123  trace.beginBlock ( "Testing class BallQuad" );
124  trace.info() << "Args:";
125  for ( int i = 0; i < argc; ++i )
126  trace.info() << " " << argv[ i ];
127  trace.info() << endl;
128 
129  bool res = testBallQuad(); // && ... other tests
130  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
131  trace.endBlock();
132  return res ? 0 : 1;
133 }
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
Trace trace
Definition: Common.h:153
bool testBallQuad()

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

◆ testBallQuad()

bool testBallQuad ( )

Definition at line 68 of file testBallQuad.cpp.

69 {
70  unsigned int nbok = 0;
71  unsigned int nb = 0;
72 
73  trace.beginBlock ( "Testing... Ball with quadnormal");
74  using namespace Z3i;
75  typedef ImplicitDigitalBall3<Point> ImplicitDigitalBall;
77  typedef Boundary::SurfelConstIterator ConstIterator;
78  typedef Boundary::Surfel Surfel;
79  Point p1( -50, -50, -50 );
80  Point p2( 50, 50, 50 );
81  KSpace K;
82  nbok += K.init( p1, p2, true ) ? 1 : 0;
83  nb++;
84  trace.info() << "(" << nbok << "/" << nb << ") "
85  << "K.init() is ok" << std::endl;
86  ImplicitDigitalBall ball( 30.0 );
87  Surfel bel = Surfaces<KSpace>::findABel( K, ball, 10000 );
88  Boundary boundary( K, ball,
90  unsigned int nbsurfels = 0;
91 
92  Board3D<Space,KSpace> board(K);
93 
94  for ( ConstIterator it = boundary.begin(), it_end = boundary.end();
95  it != it_end; ++it )
96  {
97  ++nbsurfels;
98 
100  *it,
101  board.embedKS(*it).getNormalized());
102  }
103 
104  trace.info() << nbsurfels << " surfels found." << std::endl;
105 
106  board.saveOBJ("testball.obj");
107 
108 
109  nbok += true ? 1 : 0;
110  nb++;
111  trace.info() << "(" << nbok << "/" << nb << ") "
112  << "true == true" << std::endl;
113  trace.endBlock();
114 
115  return nbok == nb;
116 }
The class Board3D is a type of Display3D which export the figures in the format OBJ/MTL when calling ...
Definition: Board3D.h:82
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
Definition: Surfaces.h:79
MyDigitalSurface::ConstIterator ConstIterator
Factory for GPL Display3D:
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
MyPointD Point
Definition: testClone2.cpp:383
KSpace K

References DGtal::Trace::beginBlock(), DGtal::Display3D< Space, KSpace >::embedKS(), DGtal::Trace::endBlock(), DGtal::PointVector< dim, TEuclideanRing, TContainer >::getNormalized(), DGtal::Trace::info(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::Board3D< Space, KSpace >::saveOBJ(), and DGtal::trace.

Referenced by main().