DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dgtalBoard3DTo2D-KSCell.cpp
1 
29 
30 #include <iostream>
31 #include "DGtal/base/Common.h"
33 
34 using namespace std;
35 using namespace DGtal;
36 
38 #include <iostream>
39 #include "DGtal/io/boards/Board3DTo2D.h"
40 #include "DGtal/base/Common.h"
41 #include "DGtal/helpers/StdDefs.h"
42 #include "DGtal/shapes/Shapes.h"
44 
45 using namespace std;
46 using namespace DGtal;
47 using namespace Z3i;
48 
50 // Standard services - public :
51 
52 int main()
53 {
54  Board3DTo2D board;
55 
56  KSpace K;
57  Point plow(0,0,0);
58  Point pup(3,3,2);
59  Domain domain( plow, pup );
60  K.init( plow, pup, true );
61 
62  //board << SetMode3D( domain.className(), "Paving" );
63  //board << domain;
64 
65  // Drawing cell of dimension 3
66  Cell voxelA = K.uCell(Point(1,1,1));
67  SCell voxelB = K.sCell(Point(1,1,3));
68  board << voxelB << voxelA;
69 
70  // drawing cells of dimension 2
71  SCell surfelA = K.sCell( Point( 2, 1, 3 ) );
72  SCell surfelB = K.sCell( Point( 1, 0, 1 ), false );
73  Cell surfelC = K.uCell( Point( 1, 2, 1 ) );
74  SCell surfelD = K.sCell( Point( 1, 1, 0 ) );
75  Cell surfelE = K.uCell( Point( 1, 1, 2 ) );
76  board << surfelA << surfelB << surfelC << surfelD << surfelE;
77 
78  Cell linelA = K.uCell(Point(2,1 ,2));
79  SCell linelB = K.sCell(Point(2,2 ,1));
80  SCell linelC = K.sCell(Point(1,2 ,2), false);
81  board << linelA << linelB << linelC;
82 
83  Cell center(Point(5,5,5));
84  // Testing display of oriented surfels:
85  SCell ssurfelXZ = K.sCell( Point( 5, 6, 5 ), false );
86  SCell ssurfelXY = K.sCell( Point( 5, 5, 6 ), false );
87  SCell ssurfelZY = K.sCell( Point( 6, 5, 5 ), false );
88  board << center;
89 
90  SCell ssurfelXZo = K.sCell( Point( 5, 4, 5 ), false );
91  SCell ssurfelXYo = K.sCell( Point( 5, 5, 4 ), false );
92  SCell ssurfelZYo = K.sCell( Point( 4, 5, 5 ), false );
93 
94  board << ssurfelXZ << ssurfelXY << ssurfelZY;
95  board << ssurfelXZo << ssurfelXYo << ssurfelZYo;
96 
97  // Testing display oriented pointels
98  Cell pointelA = K.uCell(Point(2, 2, 2));
99  SCell pointelB = K.sCell(Point(4, 4, 4), true);
100  SCell pointelC = K.sCell(Point(6, 4, 4), false);
101  SCell linelAC = K.sCell(Point(5, 4, 4), false);
102  board << pointelA << pointelB << pointelC << linelAC;
103 
104  /*board << CameraPosition(2.69044, 1.73705, -1.89961)
105  << CameraDirection(-0.515153, -0.212857, 0.830247)
106  << CameraUpVector(0.48806, -0.869135, 0.0800053);*/
107 
108  board << CameraPosition(3.49239, 3.04746, -1.40276)
109  << CameraDirection(-0.605129, -0.454197, 0.653853)
110  << CameraUpVector(0.516135, -0.84913, -0.112173);
111 
112  //board << SetMode3D(board.className(), "WireFrameMode");
113  board.saveCairo("dgtalBoard3DTo2D-KSCell.png", Board3DTo2D::CairoPNG, 600, 400);
114 }
115 // //