DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
ctopo-1.cpp
Go to the documentation of this file.
1
16
28
29
40
41
43
#include <iostream>
44
#include "DGtal/base/Common.h"
45
#include "DGtal/helpers/StdDefs.h"
46
#include "DGtal/io/boards/Board2D.h"
47
#include "DGtal/io/Color.h"
48
50
51
using namespace
std
;
52
using namespace
DGtal
;
53
using namespace
DGtal::Z2i
;
55
56
int
main
()
57
{
58
KSpace
K
;
59
Point
plow(-3,-2);
60
Point
pup(5,3);
61
Domain
domain
( plow, pup );
62
Board2D
board;
// for 2D display
63
K
.
init
( plow, pup,
true
);
64
board <<
SetMode
(
domain
.className(),
"Paving"
)
65
<<
domain
;
66
Cell
pixlow =
K
.
uSpel
( plow );
// pixel (-3*2+1,-2*2+1)
67
Cell
ptlow =
K
.
uPointel
( plow );
// pointel (-3*2,-2*2)
68
Cell
pixup =
K
.
uSpel
( pup );
// pixel (5*2+1,3*2+1)
69
Cell
ptup1 =
K
.
uPointel
( pup );
// pointel (5*2,3*2)
70
Cell
ptup2 =
K
.
uTranslation
( ptup1,
Point::diagonal
() );
// pointel (6*2,4*2)
71
Cell
linelb =
K
.
uCell
(
Point
( 1, 0 ) );
// linel (1,0) bottom
72
Cell
linelt =
K
.
uCell
(
Point
( 1, 2 ) );
// linel (1,2) top
73
Cell
linell =
K
.
uCell
(
Point
( 0, 1 ) );
// linel (0,1) left
74
Cell
linelr =
K
.
uCell
(
Point
( 2, 1 ) );
// linel (2,1) right
75
board <<
CustomStyle
( ptlow.
className
(),
76
new
CustomColors
(
Color
( 0, 0, 200 ),
77
Color
( 100, 100, 255 ) ) )
78
<< ptlow << ptup2;
79
board <<
CustomStyle
( pixlow.
className
(),
80
new
CustomColors
(
Color
( 200, 0, 0 ),
81
Color
( 255, 100, 100 ) ) )
82
<< pixlow << pixup;
83
board <<
CustomStyle
( linelb.
className
(),
84
new
CustomColors
(
Color
( 0, 200, 0 ),
85
Color
( 100, 255, 100 ) ) )
86
<< linelb << linelt << linell << linelr;
87
board.
saveSVG
(
"ctopo-1.svg"
);
88
board.
saveEPS
(
"ctopo-1.eps"
);
89
return
0;
90
}
91
// //
DGtal::Board2D
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition
Board2D.h:71
DGtal::Color::Color
Color()
Definition
Color.h:139
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::KhalimskySpaceND::uTranslation
Cell uTranslation(const Cell &p, const Vector &vec) const
Add the vector [vec] to [p].
DGtal::KhalimskySpaceND::uPointel
Cell uPointel(Point p) const
From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0)...
DGtal::KhalimskySpaceND::uCell
Cell uCell(const PreCell &c) const
From an unsigned cell, returns an unsigned cell lying into this Khalismky space.
DGtal::PointVector< dim, Integer >::diagonal
static Self diagonal(Component val=1)
DGtal::Point
DGtal::Domain
LibBoard::Board::saveEPS
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition
Board.cpp:804
LibBoard::Board::saveSVG
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition
Board.cpp:1011
DGtal::Z2i
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal::Z2i::Cell
KSpace::Cell Cell
Definition
StdDefs.h:79
DGtal::Z2i::KSpace
KhalimskySpaceND< 2, Integer > KSpace
Definition
StdDefs.h:77
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
std
STL namespace.
DGtal::CustomColors
Custom style class redefining the pen color and the fill color. You may use Board2D::Color::None for ...
Definition
Board2D.h:279
DGtal::CustomStyle::CustomStyle
CustomStyle(std::string classname, DrawableWithBoard2D *style)
Definition
Board2D.h:224
DGtal::KhalimskyCell::className
std::string className() const
Return the style name used for drawing this object.
DGtal::SetMode::SetMode
SetMode(std::string classname, std::string mode)
Definition
Board2D.h:254
K
KSpace K
Definition
testCubicalComplex.cpp:62
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
domain
Domain domain
Definition
testProjection.cpp:88
examples
topology
ctopo-1.cpp
Generated on
for DGtal by
1.18.0