DGtal  1.0.0
testDomainSpanIterator.cpp
1 
32 #include <cstdio>
33 #include <cmath>
34 #include <iostream>
35 #include <fstream>
36 #include <algorithm>
37 
38 #include "DGtal/base/Common.h"
39 #include "DGtal/kernel/SpaceND.h"
40 #include "DGtal/kernel/domains/HyperRectDomain.h"
41 
42 
43 using namespace DGtal;
44 using namespace std;
45 
46 
51 bool testIterator()
52 {
53 
54  trace.emphase() << "Iterator 4d: ";
55  typedef SpaceND<4> SpaceType4D;
56  typedef SpaceType4D::Point TPoint4D;
57  const SpaceType4D::Integer t4D[ ] = { 1, 1, 1, 1};
58  const SpaceType4D::Integer t4D2[ ] = { 3, 6, 3, 3};
59  const SpaceType4D::Integer t4D3[ ] = { 1, 2, 1, 1};
60  TPoint4D a4D ( t4D );
61  TPoint4D b4D ( t4D2 );
62  TPoint4D c4D ( t4D3);
63 
64  trace.beginBlock("Span Domain iterator test");
66  HyperRectDomain<SpaceType4D> mySpan ( a4D, b4D );
67 
68 
69  trace.emphase() << mySpan << std::endl;
70 
73  it = mySpan.subRange(1, c4D).begin();
74  it != mySpan.subRange(1, c4D).end(); ++it )
75  trace.info() << ( *it ) << std::endl;
76 
77  trace.endBlock();
78  return mySpan.isValid();
79 }
80 
81 
82 int main()
83 {
84 
85  if ( testIterator() )
86  return 0;
87  else
88  return 1;
89 }
90 
91 
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:144
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
double endBlock()
std::ostream & emphase()
bool testIterator()
int main(int argc, char **argv)
DGtal is the top-level namespace which contains all DGtal functions and types.
MyPointD Point
Definition: testClone2.cpp:383
std::ostream & info()