DGtal  0.9.3beta
range.cpp
1 
31 #include <iostream>
33 #include "DGtal/base/Common.h"
34 #include "DGtal/kernel/SpaceND.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/kernel/domains/HyperRectDomain.h"
37 #include "DGtal/io/boards/Board2D.h"
38 
40 
41 using namespace std;
42 using namespace DGtal;
43 
45 
46 int main()
47 {
48  trace.beginBlock ( "Example range" );
49 
50  typedef SpaceND<3> TSpace;
51  TSpace::Point a(1, 1, 1);
52  TSpace::Point b(5, 5, 5);
53  HyperRectDomain<TSpace> domain(a,b);
54 
55  std::vector<TSpace::Dimension> v(2); v[0]=2; v[1]=1;
56  TSpace::Point c(3,1,1);
58  it = domain.subRange(v, c).rbegin(), itend = domain.subRange(v, c).rend();
59  it != itend;
60  ++it)
61  trace.info() << "Processing point"<< (*it) << endl;
62 
63  trace.endBlock();
64 
65  trace.beginBlock ( "Example range with CPP11 initializer list" );
66 
68  it = domain.subRange({2,1}, c).rbegin(), itend = domain.subRange({2,1}, c).rend();
69  it != itend;
70  ++it)
71  trace.info() << "Processing point"<< (*it) << endl;
72 
73  trace.endBlock();
74 
75 
77  domain2=domain;
78 
80  it = domain.subRange({2,1}, c).rbegin(), itend = domain.subRange({2,1}, c).rend();
81  it != itend;
82  ++it)
83  trace.info() << "Processing point"<< (*it) << endl;
84 
85  return 0;
86 }
87 // //
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:137
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Definition: SpaceND.h:95
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
STL namespace.
double endBlock()
ConstSubRange subRange(const std::vector< Dimension > &permutation) const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & info()