DGtal 1.4.2
Loading...
Searching...
No Matches
dgtalBoard3D-2-ks.cpp File Reference
#include <iostream>
#include "DGtal/io/boards/Board3D.h"
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
Include dependency graph for dgtalBoard3D-2-ks.cpp:

Go to the source code of this file.

Functions

int main ()
 

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
Aline MARTIN (aline.nosp@m..mar.nosp@m.tin@i.nosp@m.nsa-.nosp@m.lyon..nosp@m.fr )
Date
2013/06/16

An example file named dgtalBoard3D-2-ks.

Definition in file dgtalBoard3D-2-ks.cpp.

Function Documentation

◆ main()

int main ( void )

[SetKSIllustrationMode3D]

[SetKSIllustrationMode3D]

[KSIllustrationModeTransformed]

[KSIllustrationModeTransformed]

Definition at line 53 of file dgtalBoard3D-2-ks.cpp.

54{
55
56 KSpace K;
57 Point plow(0,0,0);
58 Point pup(1,1,0);
59 Domain domain( plow, pup );
60 K.init( plow, pup, true );
61
63
64 // drawing cells of dimension 3
65
66 SCell v2 = K.sSpel( Point( 1, 0, 0 ), KSpace::POS ); // +v
67 SCell v3 = K.sSpel( Point( 0, 1, 0 ), KSpace::POS ); // +v
68 SCell v4 = K.sSpel( Point( 1, 1, 0 ), KSpace::NEG ); // +v
70 SCell v = K.sSpel( Point( 0, 0, 0 ), KSpace::POS ); // +v
71 board << SetMode3D( v.className(), "Illustration" );
73
74 board << v << v2 << v3;
75 board.saveOBJ("board3D-2-ks.obj");
76
78
79 // Surfel of Voxel (0,0)
81 SCell sx = K.sIncident( v, 0, true ); // surfel further along x
82 DGtal::TransformedPrism tsx (sx, v);
84
85 SCell sy = K.sIncident( v, 1, true ); // surfel further along y
86 SCell sz = K.sIncident( v, 2, true ); // surfel further along z
87 SCell sxn = K.sIncident( v, 0, false ); // surfel further along x
88 SCell syn = K.sIncident( v, 1, false ); // surfel further along y
89 SCell szn = K.sIncident( v, 2, false ); // surfel further along z
90
91 // Resizing and shifting the surfel towords its associated voxel (v).
92
93 DGtal::TransformedPrism tsy (sy, v);
94 DGtal::TransformedPrism tsz (sz, v);
95 DGtal::TransformedPrism tsxn (sxn, v);
96 DGtal::TransformedPrism tsyn (syn, v);
97 DGtal::TransformedPrism tszn (szn, v);
98
99 board2 << tsx << tsy << tsz << tsxn << tsyn << tszn;
100
101
102 // Surfel of Voxel (1,0)
103 SCell sx2 = K.sIncident( v2, 0, true ); // surfel further along x
104 SCell sy2 = K.sIncident( v2, 1, true ); // surfel further along y
105 SCell sz2 = K.sIncident( v2, 2, true ); // surfel further along z
106 SCell sxn2 = K.sIncident( v2, 0, false ); // surfel further along x
107 SCell syn2 = K.sIncident( v2, 1, false ); // surfel further along y
108 SCell szn2 = K.sIncident( v2, 2, false ); // surfel further along z
109
110 // Resizing and shifting the surfel towords its associated voxel (v2).
111 DGtal::TransformedPrism tsx2 (sx2, v2);
112 DGtal::TransformedPrism tsy2 (sy2, v2);
113 DGtal::TransformedPrism tsz2 (sz2, v2);
114 DGtal::TransformedPrism tsxn2 (sxn2, v2);
115 DGtal::TransformedPrism tsyn2 (syn2, v2);
116 DGtal::TransformedPrism tszn2 (szn2, v2);
117
118 board2 << tsx2 << tsy2 << tsz2 << tsxn2 << tsyn2 << tszn2;
119
120
121 // Surfel of Voxel (0,1)
122 SCell sx3 = K.sIncident( v3, 0, true ); // surfel further along x
123 SCell sy3 = K.sIncident( v3, 1, true ); // surfel further along y
124 SCell sz3 = K.sIncident( v3, 2, true ); // surfel further along z
125 SCell sxn3 = K.sIncident( v3, 0, false ); // surfel further along x
126 SCell syn3 = K.sIncident( v3, 1, false ); // surfel further along y
127 SCell szn3 = K.sIncident( v3, 2, false ); // surfel further along z
128
129 // Shifting the surfel to its associated voxel (v3).
130 DGtal::TransformedPrism tsx3 (sx3, v3);
131 DGtal::TransformedPrism tsy3 (sy3, v3);
132 DGtal::TransformedPrism tsz3 (sz3, v3);
133 DGtal::TransformedPrism tsxn3 (sxn3, v3);
134 DGtal::TransformedPrism tsyn3 (syn3, v3);
135 DGtal::TransformedPrism tszn3 (szn3, v3);
136
137
138 board2 << tsx3 << tsy3 << tsz3 << tsxn3 << tsyn3 << tszn3;
139
140 std::cout << "save obj" << std::endl;
141 board2.saveOBJ("board3D-2bis-ks.obj");
142
143
144}
The class Board3D is a type of Display3D which export the figures in the format OBJ/MTL when calling ...
Definition Board3D.h:82
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
static const constexpr Sign NEG
SCell sSpel(Point p, Sign sign=POS) const
From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimensi...
static const constexpr Sign POS
SCell sIncident(const SCell &c, Dimension k, bool up) const
Return the forward or backward signed cell incident to [c] along axis [k], depending on [up].
Z3i::SCell SCell
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
class to modify the position and scale to construct better illustration mode.
MyPointD Point
KSpace K
Domain domain

References domain, DGtal::KhalimskySpaceND< dim, TInteger >::init(), K, DGtal::KhalimskySpaceND< dim, TInteger >::NEG, DGtal::KhalimskySpaceND< dim, TInteger >::POS, DGtal::Board3D< Space, KSpace >::saveOBJ(), DGtal::KhalimskySpaceND< dim, TInteger >::sIncident(), and DGtal::KhalimskySpaceND< dim, TInteger >::sSpel().