DGtal 1.4.0
Loading...
Searching...
No Matches
io/boards/dgtalBoard3D-1-points.cpp

Example of digital point export with Display3D.

See also
Export objects with Board3D
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");
trace.endBlock();
return 0;
}
// //
The class Board3D is a type of Display3D which export the figures in the format OBJ/MTL when calling ...
Definition Board3D.h:82
void saveOBJ(const std::string &filename, const bool isNormalized=false)
Structure representing an RGB triple with alpha component.
Definition Color.h:68
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
int main()
Definition testBits.cpp:56
MyPointD Point
Domain domain
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet