DGtal  0.9.3beta
io/boards/dgtalBoard3D-1-points.cpp

Example of digital point export with Display3D.

See also
Export objects with Board3D
dgtalBoard3D-1-points.png
Illustration of the resulting exported file (OBJ format visualized with blender).
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/boards/Board3D.h"
#include "DGtal/helpers/StdDefs.h"
using namespace std;
using namespace DGtal;
using namespace DGtal::Z3i;
int main()
{
trace.beginBlock ( "Example dgtalBoard3D-1-points" );
Point p1( -3, -2, 0 );
Point p2( 7, 3 , 6);
Point p3( -1, -1, -1);
Point p4(-1, -1, 0 );
Point p5( 5, 2 , 4);
Point p6(-3, -6, 0 );
Point p7( 5, 2 , 3);
Domain domain(p4, p5);
DigitalSet shape_set( domain );
shape_set.insertNew(p6);
shape_set.insertNew(p7);
Board3D<> board;
board << SetMode3D(domain.className(), "Paving");
board << p1 << p2 << p3;
board << shape_set;
board.saveOBJ("dgtalBoard3D-1-points.obj");
trace.info()<<" Second"<<std::endl;
Board3D<> board2;
board2 << SetMode3D(domain.className(), "Paving");
board2 << CustomColors3D(Color(250, 0,0),Color(250, 0,0));
board2 << p1 ;
board2 << CustomColors3D(Color(0, 255,0),Color(0, 0,255));
board2 << p2 << p3;
board2 << CustomColors3D(Color(250, 0,0),Color(250, 0,0));
board2 << p6;
board2.saveOBJ("dgtalBoard3D-1bis-points.obj");
return 0;
}
// //