Source of examples used to generate illustrations of Cubical Complex module documention.
#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"
using namespace std;
{
typedef CubicalComplex< KSpace >
CC;
X.insertCell(
K.uSpel(
Point(1,1) ) );
X.insertCell(
K.uSpel(
Point(2,1) ) );
X.insertCell(
K.uSpel(
Point(3,1) ) );
X.insertCell(
K.uSpel(
Point(2,2) ) );
X.insertCell(
K.uSpel(
Point(3,2) ) );
X.insertCell(
K.uSpel(
Point(4,2) ) );
X.close();
Board2D board;
board << CustomStyle( X.className(),
new CustomColors( Color(80,80,100), Color(180,180,200) ) )
<< X;
board.saveTikZ( "cubical-complex-illustrations-X.tikz" );
S.insertCell(
K.uCell(
Point( 5, 4 ) ) );
S.insertCell(
K.uCell(
Point( 4, 4 ) ) );
S.insertCell(
K.uCell(
Point( 7, 5 ) ) );
board << CustomStyle( X.className(),
new CustomColors( Color::Black, Color(60,60,60) ) )
<< S;
board.saveTikZ( "cubical-complex-illustrations-S.tikz" );
board.clear();
board << CustomStyle( X.className(),
new CustomColors( Color(80,80,100), Color(180,180,200) ) )
<< X;
board << CustomStyle( X.className(),
new CustomColors( Color::Red, Color(255,120,120) ) )
<< X.closure( S );
board.saveTikZ( "cubical-complex-illustrations-closure.tikz" );
board.clear();
board << CustomStyle( X.className(),
new CustomColors( Color(80,80,100), Color(180,180,200) ) )
<< X;
board << CustomStyle( X.className(),
new CustomColors( Color::Blue, Color(120,120,255) ) )
<< X.star( S );
board.saveTikZ( "cubical-complex-illustrations-star.tikz" );
board.clear();
board << CustomStyle( X.className(),
new CustomColors( Color(80,80,100), Color(180,180,200) ) )
<< X;
board << CustomStyle( X.className(),
new CustomColors( Color::Green, Color(120,255,120) ) )
<< X.link( S );
board.saveTikZ( "cubical-complex-illustrations-link.tikz" );
board.clear();
board << CustomStyle( X.className(),
new CustomColors( Color(80,80,100), Color(180,180,200) ) )
<< X;
board << CustomStyle( X.className(),
new CustomColors( Color::Magenta, Color(255,120,255) ) )
<< X.boundary();
board.saveTikZ( "cubical-complex-illustrations-bd.tikz" );
board.clear();
board << CustomStyle( X.className(),
new CustomColors( Color(80,80,100), Color(180,180,200) ) )
<< X;
board << CustomStyle( X.className(),
new CustomColors( Color::Cyan, Color(120,255,255) ) )
<< X.interior();
board.saveTikZ( "cubical-complex-illustrations-int.tikz" );
board.clear();
board << CustomStyle( X.className(),
new CustomColors( Color(80,80,100), Color(180,180,200) ) )
<< X;
X[ p1 ] = CC::FIXED;
X[ p2 ] = CC::FIXED;
CC::DefaultCellMapIteratorPriority P;
functions::collapse( X, X.begin(), X.end(), P, true, true, true );
board << CustomStyle( X.className(),
new CustomColors( Color(255,120,20), Color(255,150,50) ) )
<< X
<< CustomStyle( p1.className(),
new CustomColors( Color::Blue, Color(120,120,255) ) )
<< p1 << p2;
board.saveTikZ( "cubical-complex-illustrations-collapse.tikz" );
board.clear();
return 0;
}
void beginBlock(const std::string &keyword="")
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
CubicalComplex< KSpace, Map > CC
HyperRectDomain< Space > Domain