DGtal  0.9.3
Functions
cubical-complex-illustrations.cpp File Reference
#include <iostream>
#include <map>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/topology/KhalimskySpaceND.h"
#include "DGtal/topology/CubicalComplex.h"
#include "DGtal/topology/CubicalComplexFunctions.h"
#include "DGtal/io/boards/Board2D.h"
Include dependency graph for cubical-complex-illustrations.cpp:

Go to the source code of this file.

Functions

int main (int, char **)
 

Detailed Description

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
Jacques-Olivier Lachaud (jacqu.nosp@m.es-o.nosp@m.livie.nosp@m.r.la.nosp@m.chaud.nosp@m.@uni.nosp@m.v-sav.nosp@m.oie..nosp@m.fr ) Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
Date
2015/08/28

An example file named cubical-complex-collapse.cpp.

This file is part of the DGtal library.

Definition in file cubical-complex-illustrations.cpp.

Function Documentation

◆ main()

int main ( int  ,
char **   
)

[cubical-complex-illustrations-X]

[cubical-complex-illustrations-X]

[cubical-complex-illustrations-S]

[cubical-complex-illustrations-S]

[cubical-complex-illustrations-closure]

[cubical-complex-illustrations-closure]

[cubical-complex-illustrations-star]

[cubical-complex-illustrations-star]

[cubical-complex-illustrations-link]

[cubical-complex-illustrations-link]

[cubical-complex-illustrations-bd]

[cubical-complex-illustrations-bd]

[cubical-complex-illustrations-int]

[cubical-complex-illustrations-int]

[cubical-complex-illustrations-collapse]

[cubical-complex-illustrations-collapse]

Definition at line 55 of file cubical-complex-illustrations.cpp.

References DGtal::CubicalComplex< TKSpace, TCellContainer >::begin(), DGtal::Trace::beginBlock(), DGtal::CubicalComplex< TKSpace, TCellContainer >::boundary(), DGtal::CubicalComplex< TKSpace, TCellContainer >::className(), LibBoard::Board::clear(), DGtal::CubicalComplex< TKSpace, TCellContainer >::close(), DGtal::CubicalComplex< TKSpace, TCellContainer >::closure(), domain(), DGtal::CubicalComplex< TKSpace, TCellContainer >::end(), DGtal::Trace::endBlock(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), DGtal::CubicalComplex< TKSpace, TCellContainer >::insertCell(), DGtal::CubicalComplex< TKSpace, TCellContainer >::interior(), K, DGtal::CubicalComplex< TKSpace, TCellContainer >::link(), LibBoard::Board::saveTikZ(), DGtal::CubicalComplex< TKSpace, TCellContainer >::star(), DGtal::trace, DGtal::KhalimskySpaceND< dim, TInteger >::uCell(), and DGtal::KhalimskySpaceND< dim, TInteger >::uSpel().

56 {
57 
59  using namespace DGtal::Z2i;
61 
62  KSpace K;
63  K.init( Point( 0,0 ), Point( 5,3 ), true );
64  trace.beginBlock( "Creating Cubical Complex" );
65  CC X( K );
66  Domain domain( Point( 0,0 ), Point( 5,3 ) );
67  X.insertCell( K.uSpel( Point(1,1) ) );
68  X.insertCell( K.uSpel( Point(2,1) ) );
69  X.insertCell( K.uSpel( Point(3,1) ) );
70  X.insertCell( K.uSpel( Point(2,2) ) );
71  X.insertCell( K.uSpel( Point(3,2) ) );
72  X.insertCell( K.uSpel( Point(4,2) ) );
73  X.close();
74  trace.endBlock();
75 
76  trace.beginBlock( "Displays Cubical Complex" );
77  Board2D board;
78  board << domain;
79  board << CustomStyle( X.className(),
80  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
81  << X;
82  board.saveTikZ( "cubical-complex-illustrations-X.tikz" );
83  trace.endBlock();
85 
87  CC S( K );
88  S.insertCell( K.uCell( Point( 5, 4 ) ) ); // a linel
89  S.insertCell( K.uCell( Point( 4, 4 ) ) ); // a pointel
90  S.insertCell( K.uCell( Point( 7, 5 ) ) ); // a pixel
91  board << CustomStyle( X.className(),
92  new CustomColors( Color::Black, Color(60,60,60) ) )
93  << S;
94  board.saveTikZ( "cubical-complex-illustrations-S.tikz" );
95  board.clear();
97 
99  board << domain;
100  board << CustomStyle( X.className(),
101  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
102  << X;
103  board << CustomStyle( X.className(),
104  new CustomColors( Color::Red, Color(255,120,120) ) )
105  << X.closure( S );
106  board.saveTikZ( "cubical-complex-illustrations-closure.tikz" );
107  board.clear();
109 
111  board << domain;
112  board << CustomStyle( X.className(),
113  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
114  << X;
115  board << CustomStyle( X.className(),
116  new CustomColors( Color::Blue, Color(120,120,255) ) )
117  << X.star( S );
118  board.saveTikZ( "cubical-complex-illustrations-star.tikz" );
119  board.clear();
121 
123  board << domain;
124  board << CustomStyle( X.className(),
125  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
126  << X;
127  board << CustomStyle( X.className(),
128  new CustomColors( Color::Green, Color(120,255,120) ) )
129  << X.link( S );
130  board.saveTikZ( "cubical-complex-illustrations-link.tikz" );
131  board.clear();
133 
135  board << domain;
136  board << CustomStyle( X.className(),
137  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
138  << X;
139  board << CustomStyle( X.className(),
140  new CustomColors( Color::Magenta, Color(255,120,255) ) )
141  << X.boundary();
142  board.saveTikZ( "cubical-complex-illustrations-bd.tikz" );
143  board.clear();
145 
147  board << domain;
148  board << CustomStyle( X.className(),
149  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
150  << X;
151  board << CustomStyle( X.className(),
152  new CustomColors( Color::Cyan, Color(120,255,255) ) )
153  << X.interior();
154  board.saveTikZ( "cubical-complex-illustrations-int.tikz" );
155  board.clear();
157 
159  board << domain;
160  board << CustomStyle( X.className(),
161  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
162  << X;
163  Cell p1 = K.uCell( Point(2,2) );
164  Cell p2 = K.uCell( Point(10,6) );
165  X[ p1 ] = CC::FIXED;
166  X[ p2 ] = CC::FIXED;
168  functions::collapse( X, X.begin(), X.end(), P, true, true, true );
169  board << CustomStyle( X.className(),
170  new CustomColors( Color(255,120,20), Color(255,150,50) ) )
171  << X
172  << CustomStyle( p1.className(),
173  new CustomColors( Color::Blue, Color(120,120,255) ) )
174  << p1 << p2;
175  board.saveTikZ( "cubical-complex-illustrations-collapse.tikz" );
176  board.clear();
178 
179  return 0;
180 }
void beginBlock(const std::string &keyword="")
static const Color Black
Definition: Color.h:388
const Domain domain(Point(1, 2), Point(6, 5))
Trace trace
Definition: Common.h:137
static const Color Magenta
Definition: Color.h:396
uint64_t collapse(CubicalComplex< TKSpace, TCellContainer > &K, CellConstIterator S_itB, CellConstIterator S_itE, const CellMapIteratorPriority &priority, bool hintIsSClosed=false, bool hintIsKClosed=false, bool verbose=false)
double endBlock()
static const Color Cyan
Definition: Color.h:395
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Definition: Board2D.h:278
static const Color Blue
Definition: Color.h:394
Cell uSpel(Point p) const
bool init(const Point &lower, const Point &upper, bool isClosed)
Cell uCell(const PreCell &c) const
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition: Board.cpp:152
Aim: This class represents an arbitrary cubical complex living in some Khalimsky space. Cubical complexes are sets of cells of different dimensions related together with incidence relations. Two cells in a cubical complex are incident if and only if they are incident in the surrounding Khalimsky space. In other words, cubical complexes are defined here as subsets of Khalimsky spaces.
Z2i this namespace gathers the standard of types for 2D imagery.
Space::Point Point
Definition: StdDefs.h:95
CubicalComplex< KSpace, Map > CC
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
KSpace K
static const Color Red
Definition: Color.h:391
static const Color Green
Definition: Color.h:392
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex...
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1219
Aim: This class specializes a &#39;Board&#39; class so as to display DGtal objects more naturally (with <<)...
Definition: Board2D.h:70