DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
range.cpp
1 
31 
32 #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 #ifdef CPP11_INITIALIZER_LIST
66  trace.beginBlock ( "Example range with CPP11 initializer list" );
67 
69  it = domain.subRange({2,1}, c).rbegin(), itend = domain.subRange({2,1}, c).rend();
70  it != itend;
71  ++it)
72  trace.info() << "Processing point"<< (*it) << endl;
73 
74  trace.endBlock();
75 
76 
78  domain2=domain;
79 
81  it = domain.subRange({2,1}, c).rbegin(), itend = domain.subRange({2,1}, c).rend();
82  it != itend;
83  ++it)
84  trace.info() << "Processing point"<< (*it) << endl;
85 
86 #endif
87 
88  return 0;
89 }
90 // //