DGtal
1.5.beta
range.cpp
Go to the documentation of this file.
1
41
#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);
66
for
(
HyperRectDomain<TSpace>::ConstSubRange::ConstReverseIterator
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
76
for
(
HyperRectDomain<TSpace>::ConstSubRange::ConstReverseIterator
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
85
HyperRectDomain<TSpace>
domain2;
86
domain2=
domain
;
87
88
for
(
HyperRectDomain<TSpace>::ConstSubRange::ConstReverseIterator
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
// //
DGtal::HyperRectDomain_ReverseIterator
Reverse iterator for HyperRectDomain.
Definition:
HyperRectDomain_Iterator.h:74
DGtal::HyperRectDomain
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Definition:
HyperRectDomain.h:100
DGtal::HyperRectDomain::subRange
ConstSubRange subRange(const std::vector< Dimension > &permutation) const
Definition:
HyperRectDomain.h:472
DGtal::SpaceND
Definition:
SpaceND.h:96
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::info
std::ostream & info()
DGtal::Trace::endBlock
double endBlock()
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::trace
Trace trace
Definition:
Common.h:153
main
int main()
Definition:
range.cpp:55
Point
MyPointD Point
Definition:
testClone2.cpp:383
domain
Domain domain
Definition:
testProjection.cpp:88
examples
doc-examples
range.cpp
Generated on Sat Nov 9 2024 12:44:48 for DGtal by
1.9.1