DGtal  0.9.3beta
io/boards/dgtalBoard3D-6-clipping.cpp

Example of clipped object export with Display3D.

See also
Export objects with Board3D
dgtalBoard3D-6-clipping.png
Illustration of the resulting exported file (OBJ format visualized with blender).
#include <iostream>
#include "DGtal/io/boards/Board3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/Color.h"
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
using namespace std;
using namespace DGtal;
using namespace Z3i;
// Standard services - public :
int main( int /*argc*/, char** /*argv*/ )
{
Board3D<> board;
Point p1( 0, 0, 0 );
Point p2( 20, 20, 20 );
Domain domain(p1, p2);
DigitalSet shape_set( domain );
Shapes<Domain>::addNorm2Ball( shape_set, Point( 10, 10, 10 ), 7 );
board << SetMode3D( shape_set.className(), "Both" );
board << shape_set;
board << CustomColors3D(Color(250, 200,0, 100),Color(250, 200,0, 20));
board << SetMode3D( p1.className(), "Paving" );
board << ClippingPlane(1,0,0,-4.9);
board << ClippingPlane(0,1,0.3,-10);
board.saveOBJ("board3D-6-clipping.obj");
}
// //