DGtal  1.3.beta
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/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 54 of file cubical-complex-illustrations.cpp.

55 {
56 
58  using namespace DGtal::Z2i;
60 
61  KSpace K;
62  K.init( Point( 0,0 ), Point( 5,3 ), true );
63  trace.beginBlock( "Creating Cubical Complex" );
64  CC X( K );
65  Domain domain( Point( 0,0 ), Point( 5,3 ) );
66  X.insertCell( K.uSpel( Point(1,1) ) );
67  X.insertCell( K.uSpel( Point(2,1) ) );
68  X.insertCell( K.uSpel( Point(3,1) ) );
69  X.insertCell( K.uSpel( Point(2,2) ) );
70  X.insertCell( K.uSpel( Point(3,2) ) );
71  X.insertCell( K.uSpel( Point(4,2) ) );
72  X.close();
73  trace.endBlock();
74 
75  trace.beginBlock( "Displays Cubical Complex" );
76  Board2D board;
77  board << domain;
78  board << CustomStyle( X.className(),
79  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
80  << X;
81  board.saveTikZ( "cubical-complex-illustrations-X.tikz" );
82  trace.endBlock();
84 
86  CC S( K );
87  S.insertCell( K.uCell( Point( 5, 4 ) ) ); // a linel
88  S.insertCell( K.uCell( Point( 4, 4 ) ) ); // a pointel
89  S.insertCell( K.uCell( Point( 7, 5 ) ) ); // a pixel
90  board << CustomStyle( X.className(),
91  new CustomColors( Color::Black, Color(60,60,60) ) )
92  << S;
93  board.saveTikZ( "cubical-complex-illustrations-S.tikz" );
94  board.clear();
96 
98  board << domain;
99  board << CustomStyle( X.className(),
100  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
101  << X;
102  board << CustomStyle( X.className(),
103  new CustomColors( Color::Red, Color(255,120,120) ) )
104  << X.closure( S );
105  board.saveTikZ( "cubical-complex-illustrations-closure.tikz" );
106  board.clear();
108 
110  board << domain;
111  board << CustomStyle( X.className(),
112  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
113  << X;
114  board << CustomStyle( X.className(),
115  new CustomColors( Color::Blue, Color(120,120,255) ) )
116  << X.star( S );
117  board.saveTikZ( "cubical-complex-illustrations-star.tikz" );
118  board.clear();
120 
122  board << domain;
123  board << CustomStyle( X.className(),
124  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
125  << X;
126  board << CustomStyle( X.className(),
127  new CustomColors( Color::Green, Color(120,255,120) ) )
128  << X.link( S );
129  board.saveTikZ( "cubical-complex-illustrations-link.tikz" );
130  board.clear();
132 
134  board << domain;
135  board << CustomStyle( X.className(),
136  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
137  << X;
138  board << CustomStyle( X.className(),
139  new CustomColors( Color::Magenta, Color(255,120,255) ) )
140  << X.boundary();
141  board.saveTikZ( "cubical-complex-illustrations-bd.tikz" );
142  board.clear();
144 
146  board << domain;
147  board << CustomStyle( X.className(),
148  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
149  << X;
150  board << CustomStyle( X.className(),
151  new CustomColors( Color::Cyan, Color(120,255,255) ) )
152  << X.interior();
153  board.saveTikZ( "cubical-complex-illustrations-int.tikz" );
154  board.clear();
156 
158  board << domain;
159  board << CustomStyle( X.className(),
160  new CustomColors( Color(80,80,100), Color(180,180,200) ) )
161  << X;
162  Cell p1 = K.uCell( Point(2,2) );
163  Cell p2 = K.uCell( Point(10,6) );
164  X[ p1 ] = CC::FIXED;
165  X[ p2 ] = CC::FIXED;
167  functions::collapse( X, X.begin(), X.end(), P, true, true, true );
168  board << CustomStyle( X.className(),
169  new CustomColors( Color(255,120,20), Color(255,150,50) ) )
170  << X
171  << CustomStyle( p1.className(),
172  new CustomColors( Color::Blue, Color(120,120,255) ) )
173  << p1 << p2;
174  board.saveTikZ( "cubical-complex-illustrations-collapse.tikz" );
175  board.clear();
177 
178  return 0;
179 }

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

DGtal::KhalimskyCell::className
std::string className() const
Return the style name used for drawing this object.
DGtal::KhalimskySpaceND::uCell
Cell uCell(const PreCell &c) const
From an unsigned cell, returns an unsigned cell lying into this Khalismky space.
DGtal::HyperRectDomain< Space >
DGtal::Trace::endBlock
double endBlock()
DGtal::Z2i::Point
Space::Point Point
Definition: StdDefs.h:95
DGtal::Z2i
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal::Color::Green
static const Color Green
Definition: Color.h:393
DGtal::Color
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
DGtal::KhalimskySpaceND::uSpel
Cell uSpel(Point p) const
From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimensi...
DGtal::KhalimskySpaceND::init
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
DGtal::trace
Trace trace
Definition: Common.h:154
K
KSpace K
Definition: testCubicalComplex.cpp:62
DGtal::Color::Cyan
static const Color Cyan
Definition: Color.h:396
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Color::Black
static const Color Black
Definition: Color.h:389
LibBoard::Board::clear
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition: Board.cpp:152
DGtal::Color::Blue
static const Color Blue
Definition: Color.h:395
DGtal::functions::collapse
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)
DGtal::CustomStyle
Definition: Board2D.h:217
DGtal::Color::Red
static const Color Red
Definition: Color.h:392
DGtal::CustomColors
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Definition: Board2D.h:278
CC
CubicalComplex< KSpace, Map > CC
Definition: testCubicalComplex.cpp:58
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:70
DGtal::Color::Magenta
static const Color Magenta
Definition: Color.h:397
LibBoard::Board::saveTikZ
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1219
domain
Domain domain
Definition: testProjection.cpp:88
DGtal::PointVector< dim, Integer >
DGtal::CubicalComplex
Aim: This class represents an arbitrary cubical complex living in some Khalimsky space....
Definition: CubicalComplex.h:84
DGtal::CubicalComplex::DefaultCellMapIteratorPriority
Definition: CubicalComplex.h:282
DGtal::KhalimskyCell< dim, Integer >
DGtal::KhalimskySpaceND
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Definition: KhalimskySpaceND.h:64