DGtal  0.9.2
dgtalBoard3DTo2D-0-demo-kernel-2.cpp
1 
29 #include <iostream>
31 #include "DGtal/io/boards/Board3DTo2D.h"
32 #include "DGtal/io/DrawWithDisplay3DModifier.h"
33 #include "DGtal/base/Common.h"
34 #include "DGtal/kernel/SpaceND.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/kernel/domains/HyperRectDomain.h"
37 
39 
40 using namespace std;
41 using namespace DGtal;
42 
44 
45 int main()
46 {
47  typedef DGtal::SpaceND<3, DGtal::int32_t> MySpace;
48  typedef MySpace::Point MyPoint;
49  typedef HyperRectDomain<MySpace> MyDomain;
50 
51  MyPoint p1( 0, 0, 0 );
52  MyPoint p2( 5, 5 ,5 );
53  MyPoint p3( 2, 3, 4 );
54  MyDomain domain( p1, p2 );
55 
56  Board3DTo2D<> board;
57 
58  board << domain;
59  board << p1 << p2 << p3;
60 
61  board << CameraPosition(2.500000, 2.500000, 16.078199)
62  << CameraDirection(0.000000, 0.000000, -1.000000)
63  << CameraUpVector(0.000000, 1.000000, 0.000000);
64 
65  board << SetMode3D(board.className(), "WireFrameMode");
66  board.saveCairo("dgtalBoard3DTo2D-0-demo-kernel-2.png", Board3DTo2D<>::CairoPNG, 600, 400);
67 }
68 // //
CameraUpVector class to set camera up-vector.
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Definition: Common.h:138
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Definition: SpaceND.h:95
void saveCairo(const char *filename, CairoType type, int bWidth, int bHeight)
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
CameraDirection class to set camera direction.
STL namespace.
CameraPosition class to set camera position.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::string className() const
Definition: Board3DTo2D.h:104
Modifier class in a Display3D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithDisplay3D.