32 #include "DGtal/base/Common.h" 33 #include "ConfigTest.h" 34 #include "DGtal/helpers/StdDefs.h" 35 #include "DGtal/topology/ImplicitDigitalSurface.h" 36 #include "DGtal/io/boards/Board3D.h" 40 using namespace DGtal;
49 template <
typename TPo
int3>
50 struct ImplicitDigitalBall3 {
51 typedef TPoint3
Point;
53 ImplicitDigitalBall3(
double r )
57 bool operator()(
const TPoint3 & p )
const 59 double x = ( (double) p[ 0 ] );
60 double y = ( (double) p[ 1 ] );
61 double z = ( (double) p[ 2 ] );
62 return ( x*x + y*y + z*z -myR*myR) <= 0.0;
70 unsigned int nbok = 0;
75 typedef ImplicitDigitalBall3<Point> ImplicitDigitalBall;
78 typedef Boundary::Surfel Surfel;
79 Point p1( -50, -50, -50 );
80 Point p2( 50, 50, 50 );
82 nbok +=
K.
init( p1, p2,
true ) ? 1 : 0;
84 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 85 <<
"K.init() is ok" << std::endl;
86 ImplicitDigitalBall ball( 30.0 );
88 Boundary boundary(
K, ball,
90 unsigned int nbsurfels = 0;
94 for (
ConstIterator it = boundary.begin(), it_end = boundary.end();
104 trace.
info() << nbsurfels <<
" surfels found." << std::endl;
109 nbok +=
true ? 1 : 0;
111 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 112 <<
"true == true" << std::endl;
121 int main(
int argc,
char** argv )
125 for (
int i = 0; i < argc; ++i )
130 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
MyDigitalSurface::ConstIterator ConstIterator
void saveOBJ(const std::string &filename, const bool isNormalized=false)
Aim: A utility class for constructing surfaces (i.e. set of (n-1)-cells).
PointVector< dim, double, std::array< double, dim > > getNormalized() const
Factory for GPL Display3D:
RealPoint embedKS(const typename KSpace::SCell &cell) const
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
The class Board3D is a type of Display3D which export the figures in the format OBJ/MTL when calling ...
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
int main(int argc, char **argv)
Aim: A model of CDigitalSurfaceContainer which defines the digital surface as the boundary of an impl...