A simple example of cellular grid space with several cells instantiated and visualized in 3D. This program outputs this image.
- See also
- Cells may be unsigned or signed
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/viewers/Viewer3D.h"
int main(
int argc,
char** argv )
{
QApplication application(argc,argv);
K.init( plow, pup,
true );
viewer.show();
Cell ptlow =
K.uPointel( plow );
Cell ptup1 =
K.uPointel( pup );
Cell ptup2 =
K.uTranslation( ptup1, Point::diagonal() );
viewer << ptlow << ptup1 << ptup2;
Cell p1=
K.uCell(
Point(0,0,2));
Cell p2=
K.uCell(
Point(0,2,2));
Cell p3=
K.uCell(
Point(2,2,2));
Cell p4=
K.uCell(
Point(2,0,2));
Cell p5=
K.uCell(
Point(0,0,4));
Cell p6=
K.uCell(
Point(0,2,4));
Cell p7=
K.uCell(
Point(2,2,4));
Cell p8=
K.uCell(
Point(2,0,4));
viewer << p1 << p2 << p3 << p4 << p5 << p6 << p7 << p8;
Cell linel0 =
K.uCell(
Point( 1, 0, 2 ) );
Cell linel1 =
K.uCell(
Point( 1, 2, 2 ) );
Cell linel2 =
K.uCell(
Point( 0, 1, 2 ) );
Cell linel3 =
K.uCell(
Point( 2, 1, 2 ) );
Cell linel4 =
K.uCell(
Point( 1, 0, 4 ) );
Cell linel5 =
K.uCell(
Point( 1, 2, 4 ) );
Cell linel6 =
K.uCell(
Point( 0, 1, 4 ) );
Cell linel7 =
K.uCell(
Point( 2, 1, 4 ) );
Cell linel8 =
K.uCell(
Point( 0, 0, 3 ) );
Cell linel9 =
K.uCell(
Point( 0, 2, 3 ) );
Cell linel10 =
K.uCell(
Point( 2, 0, 3 ) );
Cell linel11 =
K.uCell(
Point( 2, 2, 3 ) );
Cell linel12 =
K.uCell(
Point( 3, 2, 2 ) );
viewer << linel0<< linel1<< linel2 << linel3 ;
viewer << linel4<< linel5<< linel6 << linel7 ;
viewer << linel8<< linel9<< linel10 << linel11 << linel12;
Cell surfelA =
K.uCell(
Point( 2, 1, 3 ) );
Cell surfelB =
K.uCell(
Point( 1, 0, 1 ) );
Cell surfelC =
K.uCell(
Point( 2, 1, 1 ) );
viewer << surfelA << surfelB << surfelC;
Cell vox1 =
K.uCell(
Point( 3, 3, 3 ) );
Cell vox2 =
K.uCell(
Point( 1, 1, 3 ) );
viewer << vox1 << vox2;
viewer<< MyViewer::updateDisplay;
return application.exec();
}
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
HyperRectDomain< Space > Domain