This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
- Author
- Bertrand Kerautret (
kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr
) LORIA (CNRS, UMR 7503), University of Nancy, France
- Date
- 2011/04/30
An example file named KhalimskySpaceScanner.
This file is part of the DGtal library.
Definition in file khalimskySpaceScanner.cpp.
int main |
( |
int | argc, |
|
|
char ** | argv ) |
Definition at line 62 of file khalimskySpaceScanner.cpp.
63{
66 for ( int i = 0; i < argc; ++i )
69
70
73
74
78
80 boardScan1 <<
SetMode( dom.className(),
"Paving" )
81 << dom;
82 boardScan2 <<
SetMode( dom.className(),
"Paving" )
83 << dom;
84
85 K.
init( dom.lowerBound(),dom.upperBound(),
true );
86
87
88
91
92
95 bool first=true;
96
97 do
98 {
99 boardScan1 << p;
100 if(first){
101 first=false;
102 prec=p;
103 continue;
104 }
105
109 prec=p;
110 }
112
113
114
115
116
119 bool firstq = true;
122 {
123 for ( KPS::uSetKCoord( qq,
K.
uFirst( qq, 1 ), 1 );
K.
uIsInside(qq, 1); qq = KPS::uGetIncr(qq, 1) )
124 {
126 boardScan2 << q;
127 if(firstq){
128 firstq = false;
129 precq = q;
130 continue;
131 }
132
136 precq = q;
137 }
138 }
139
140 boardScan1.
saveSVG(
"khalimskySpaceScanner1.svg");
141 boardScan1.
saveFIG(
"khalimskySpaceScanner1.fig");
142
143 boardScan2.
saveSVG(
"khalimskySpaceScanner2.svg");
144 boardScan2.
saveFIG(
"khalimskySpaceScanner2.fig");
145
146 return 0;
147
148}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Structure representing an RGB triple with alpha component.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Cell uSpel(Point p) const
From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimensi...
bool uIsInside(const PreCell &p, Dimension k) const
Useful to check if you are going out of the space.
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Cell uGetMax(Cell p, Dimension k) const
Useful to check if you are going out of the space.
Integer uLast(const PreCell &p, Dimension k) const
Return the k-th Khalimsky coordinate of the last cell of the space with the same type as [p].
bool uNext(Cell &p, const Cell &lower, const Cell &upper) const
Increment the cell [p] to its next position (as classically done in a scanning).
Cell uCell(const PreCell &c) const
From an unsigned cell, returns an unsigned cell lying into this Khalismky space.
Integer uFirst(const PreCell &p, Dimension k) const
Return the k-th Khalimsky coordinate of the first cell of the space with the same type as [p].
Point uCoords(const Cell &c) const
Return its digital coordinates.
void beginBlock(const std::string &keyword="")
Board & setPenColor(const DGtal::Color &color)
void saveFIG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
KhalimskyPreSpaceND< 2, Integer > KPreSpace
static void draw(DGtal::Board2D &board, const DGtal::DiscreteExteriorCalculus< dimEmbedded, dimAmbient, TLinearAlgebraBackend, TInteger > &calculus)
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
References DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::className(), DGtal::Display2DFactory::draw(), DGtal::Trace::info(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::HyperRectDomain< TSpace >::lowerBound(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), LibBoard::Board::setPenColor(), DGtal::trace, DGtal::KhalimskySpaceND< dim, TInteger >::uCell(), DGtal::KhalimskySpaceND< dim, TInteger >::uCoords(), DGtal::KhalimskySpaceND< dim, TInteger >::uFirst(), DGtal::KhalimskySpaceND< dim, TInteger >::uGetMax(), DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside(), DGtal::KhalimskySpaceND< dim, TInteger >::uLast(), DGtal::KhalimskySpaceND< dim, TInteger >::uNext(), DGtal::HyperRectDomain< TSpace >::upperBound(), and DGtal::KhalimskySpaceND< dim, TInteger >::uSpel().