DGtal  0.9.4beta
range.cpp
1 
40 #include <iostream>
42 #include "DGtal/base/Common.h"
43 #include "DGtal/kernel/SpaceND.h"
44 #include "DGtal/helpers/StdDefs.h"
45 #include "DGtal/kernel/domains/HyperRectDomain.h"
46 #include "DGtal/io/boards/Board2D.h"
47 
49 
50 using namespace std;
51 using namespace DGtal;
52 
54 
55 int main()
56 {
57  trace.beginBlock ( "Example range" );
58 
59  typedef SpaceND<3> TSpace;
60  TSpace::Point a(1, 1, 1);
61  TSpace::Point b(5, 5, 5);
62  HyperRectDomain<TSpace> domain(a,b);
63 
64  std::vector<TSpace::Dimension> v(2); v[0]=2; v[1]=1;
65  TSpace::Point c(3,1,1);
67  it = domain.subRange(v, c).rbegin(), itend = domain.subRange(v, c).rend();
68  it != itend;
69  ++it)
70  trace.info() << "Processing point"<< (*it) << endl;
71 
72  trace.endBlock();
73 
74  trace.beginBlock ( "Example range with CPP11 initializer list" );
75 
77  it = domain.subRange({2,1}, c).rbegin(), itend = domain.subRange({2,1}, c).rend();
78  it != itend;
79  ++it)
80  trace.info() << "Processing point"<< (*it) << endl;
81 
82  trace.endBlock();
83 
84 
86  domain2=domain;
87 
89  it = domain.subRange({2,1}, c).rbegin(), itend = domain.subRange({2,1}, c).rend();
90  it != itend;
91  ++it)
92  trace.info() << "Processing point"<< (*it) << endl;
93 
94  return 0;
95 }
96 // //
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()