A simple example of cellular grid space with several cells instantiated and visualized in 3D. This program outputs this image.
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
using namespace std;
int main(
int argc,
char** argv )
{
QApplication application(argc,argv);
K.init( plow, pup,
true );
typedef Viewer3D<Space, KSpace> MyViewer;
viewer.show();
SCell ptlow =
K.sPointel( plow );
SCell ptup1 =
K.sPointel( pup );
SCell ptup2 =
K.sTranslation( ptup1, Point::diagonal() );
viewer << ptlow << ptup1 << ptup2;
SCell p1=
K.sCell(
Point(0,0,2),
false);
SCell p2=
K.sCell(
Point(0,2,2));
SCell p3=
K.sCell(
Point(2,2,2),
false);
SCell p4=
K.sCell(
Point(2,0,2));
SCell p5=
K.sCell(
Point(0,0,4),
false);
SCell p6=
K.sCell(
Point(0,2,4));
SCell p7=
K.sCell(
Point(2,2,4),
false);
SCell p8=
K.sCell(
Point(2,0,4));
viewer << p1 << p2 << p3 << p4 << p5 << p6 << p7 << p8;
SCell linel0 =
K.sCell(
Point( 1, 0, 2 ) );
SCell linel1 =
K.sCell(
Point( 1, 2, 2 ) );
SCell linel2 =
K.sCell(
Point( 0, 1, 2 ) );
SCell linel3 =
K.sCell(
Point( 2, 1, 2 ) );
SCell linel4 =
K.sCell(
Point( 1, 0, 4 ) );
SCell linel5 =
K.sCell(
Point( 1, 2, 4 ) );
SCell linel6 =
K.sCell(
Point( 0, 1, 4 ) );
SCell linel7 =
K.sCell(
Point( 2, 1, 4 ) );
SCell linel8 =
K.sCell(
Point( 0, 0, 3 ) );
SCell linel9 =
K.sCell(
Point( 0, 2, 3 ) );
SCell linel10 =
K.sCell(
Point( 2, 0, 3 ) );
SCell linel11 =
K.sCell(
Point( 2, 2, 3 ) );
SCell linel12 =
K.sCell(
Point( 3, 2, 2 ) );
viewer << linel0<< linel1<< linel2 << linel3 ;
viewer << linel4<< linel5<< linel6 << linel7 ;
viewer << linel8<< linel9<< linel10 << linel11 << linel12;
SCell surfelA =
K.sCell(
Point( 2, 1, 3 ) );
SCell surfelB =
K.sCell(
Point( 1, 0, 1 ) );
SCell surfelC =
K.sCell(
Point( 2, 1, 1 ),
false );
viewer << surfelA << surfelB << surfelC;
SCell vox1 =
K.sCell(
Point( 3, 3, 3 ) );
SCell vox2 =
K.sCell(
Point( 1, 1, 3 ) ,
false );
viewer << vox1 << vox2;
viewer << CameraPosition(-2.9, 2.96, 2.64)
<< CameraDirection(0.6, -0.43, 0.65)
<< CameraUpVector(0.32, 0.900, 0.29);
viewer<< MyViewer::updateDisplay;
return application.exec();
return 0;
}
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
HyperRectDomain< Space > Domain