DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
examples
topology
ctopo-1.cpp
1
29
30
#include <iostream>
31
#include "DGtal/base/Common.h"
32
#include "DGtal/helpers/StdDefs.h"
33
#include "DGtal/io/boards/Board2D.h"
34
#include "DGtal/io/Color.h"
35
37
38
using namespace
std;
39
using namespace
DGtal;
40
using namespace
DGtal::Z2i;
42
43
int
main()
44
{
45
KSpace
K;
46
Point
plow(-3,-2);
47
Point
pup(5,3);
48
Domain
domain( plow, pup );
49
Board2D
board;
// for 2D display
50
K.
init
( plow, pup,
true
);
51
board <<
SetMode
( domain.className(),
"Paving"
)
52
<< domain;
53
Cell
pixlow = K.
uSpel
( plow );
// pixel (-3*2+1,-2*2+1)
54
Cell
ptlow = K.
uPointel
( plow );
// pointel (-3*2,-2*2)
55
Cell
pixup = K.
uSpel
( pup );
// pixel (5*2+1,3*2+1)
56
Cell
ptup1 = K.
uPointel
( pup );
// pointel (5*2,3*2)
57
Cell
ptup2 = K.
uTranslation
( ptup1, Point::diagonal() );
// pointel (6*2,4*2)
58
Cell
linelb = K.
uCell
(
Point
( 1, 0 ) );
// linel (1,0) bottom
59
Cell
linelt = K.
uCell
(
Point
( 1, 2 ) );
// linel (1,2) top
60
Cell
linell = K.
uCell
(
Point
( 0, 1 ) );
// linel (0,1) left
61
Cell
linelr = K.
uCell
(
Point
( 2, 1 ) );
// linel (2,1) right
62
board <<
CustomStyle
( ptlow.
className
(),
63
new
CustomColors
(
Color
( 0, 0, 200 ),
64
Color
( 100, 100, 255 ) ) )
65
<< ptlow << ptup2;
66
board <<
CustomStyle
( pixlow.className(),
67
new
CustomColors
(
Color
( 200, 0, 0 ),
68
Color
( 255, 100, 100 ) ) )
69
<< pixlow << pixup;
70
board <<
CustomStyle
( linelb.
className
(),
71
new
CustomColors
(
Color
( 0, 200, 0 ),
72
Color
( 100, 255, 100 ) ) )
73
<< linelb << linelt << linell << linelr;
74
board.
saveSVG
(
"ctopo-1.svg"
);
75
board.
saveEPS
(
"ctopo-1.eps"
);
76
return
0;
77
}
78
// //
Generated on Wed Dec 19 2012 19:10:21 for DGtal by
1.8.1.1