DGtal  1.5.beta
io/viewers/viewer3D-4bis-illustrationMode.cpp
Illustration of the "Illustration" KhalimskyCell mode.
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
using namespace std;
using namespace DGtal;
using namespace Z3i;
// Standard services - public :
int main( int argc, char** argv )
{
QApplication application(argc,argv);
Point plow(0,0,0);
Point pup(1,1,0);
Domain domain( plow, pup );
K.init( plow, pup, true );
typedef Viewer3D<Space, KSpace> MyViewer;
MyViewer viewer(K);
viewer.show();
viewer << SetMode3D( domain.className(), "Paving" );
viewer << domain;
// drawing cells of dimension 3
SCell v2 = K.sSpel( Point( 1, 0, 0 ), KSpace::POS ); // +v
SCell v3 = K.sSpel( Point( 0, 1, 0 ), KSpace::POS ); // +v
SCell v4 = K.sSpel( Point( 1, 1, 0 ), KSpace::NEG ); // +v
SCell v = K.sSpel( Point( 0, 0, 0 ), KSpace::POS ); // +v
viewer << SetMode3D( v.className(), "Illustration" );
viewer << v << v2 << v3;
// Surfel of Voxel (0,0)
SCell sx = K.sIncident( v, 0, true ); // surfel further along x
SCell sy = K.sIncident( v, 1, true ); // surfel further along y
SCell sz = K.sIncident( v, 2, true ); // surfel further along z
SCell sxn = K.sIncident( v, 0, false ); // surfel further along x
SCell syn = K.sIncident( v, 1, false ); // surfel further along y
SCell szn = K.sIncident( v, 2, false ); // surfel further along z
// Resizing and shifting the surfel towords its associated voxel (v).
DGtal::TransformedPrism tsxn (sxn, v);
DGtal::TransformedPrism tsyn (syn, v);
DGtal::TransformedPrism tszn (szn, v);
viewer << tsx << tsy << tsz << tsxn << tsyn << tszn;
// Surfel of Voxel (1,0)
SCell sx2 = K.sIncident( v2, 0, true ); // surfel further along x
SCell sy2 = K.sIncident( v2, 1, true ); // surfel further along y
SCell sz2 = K.sIncident( v2, 2, true ); // surfel further along z
SCell sxn2 = K.sIncident( v2, 0, false ); // surfel further along x
SCell syn2 = K.sIncident( v2, 1, false ); // surfel further along y
SCell szn2 = K.sIncident( v2, 2, false ); // surfel further along z
// Resizing and shifting the surfel towords its associated voxel (v2).
DGtal::TransformedPrism tsx2 (sx2, v2);
DGtal::TransformedPrism tsy2 (sy2, v2);
DGtal::TransformedPrism tsz2 (sz2, v2);
DGtal::TransformedPrism tsxn2 (sxn2, v2);
DGtal::TransformedPrism tsyn2 (syn2, v2);
DGtal::TransformedPrism tszn2 (szn2, v2);
viewer << tsx2 << tsy2 << tsz2 << tsxn2 << tsyn2 << tszn2;
// Surfel of Voxel (0,1)
SCell sx3 = K.sIncident( v3, 0, true ); // surfel further along x
SCell sy3 = K.sIncident( v3, 1, true ); // surfel further along y
SCell sz3 = K.sIncident( v3, 2, true ); // surfel further along z
SCell sxn3 = K.sIncident( v3, 0, false ); // surfel further along x
SCell syn3 = K.sIncident( v3, 1, false ); // surfel further along y
SCell szn3 = K.sIncident( v3, 2, false ); // surfel further along z
// Shifting the surfel to its associated voxel (v3).
DGtal::TransformedPrism tsx3 (sx3, v3);
DGtal::TransformedPrism tsy3 (sy3, v3);
DGtal::TransformedPrism tsz3 (sz3, v3);
DGtal::TransformedPrism tsxn3 (sxn3, v3);
DGtal::TransformedPrism tsyn3 (syn3, v3);
DGtal::TransformedPrism tszn3 (szn3, v3);
viewer << tsx3 << tsy3 << tsz3 << tsxn3 << tsyn3 << tszn3;
viewer << MyViewer::updateDisplay;
return application.exec();
}
// //
Z3i::SCell SCell
DGtal is the top-level namespace which contains all DGtal functions and types.
class to modify the position and scale to construct better illustration mode.
int main(int argc, char **argv)
MyPointD Point
Definition: testClone2.cpp:383
KSpace K
Domain domain
HyperRectDomain< Space > Domain