DGtal 1.3.0
Loading...
Searching...
No Matches
dgtalBoard3DTo2D-KSCell.cpp
1
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
45using namespace std;
46using namespace DGtal;
47using namespace Z3i;
48
50// Standard services - public :
51
52int main()
53{
54
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 Board3DTo2D<> board(K);
63
64 board << SetMode3D( domain.className(), "Paving" );
65 board << domain;
66
67 // Drawing cell of dimension 3
68 Cell voxelA = K.uCell(Point(1,1,1));
69 SCell voxelB = K.sCell(Point(1,1,3));
70 board << voxelB << voxelA;
71
72 // drawing cells of dimension 2
73 SCell surfelA = K.sCell( Point( 2, 1, 3 ) );
74 SCell surfelB = K.sCell( Point( 1, 0, 1 ), false );
75 Cell surfelC = K.uCell( Point( 1, 2, 1 ) );
76 SCell surfelD = K.sCell( Point( 1, 1, 0 ) );
77 Cell surfelE = K.uCell( Point( 1, 1, 2 ) );
78 board << surfelA << surfelB << surfelC << surfelD << surfelE;
79
80 Cell linelA = K.uCell(Point(2,1 ,2));
81 SCell linelB = K.sCell(Point(2,2 ,1));
82 SCell linelC = K.sCell(Point(1,2 ,2), false);
83 board << linelA << linelB << linelC;
84
85 Cell center = K.uCell(Point(5,5,5));
86
87 // Testing display of oriented surfels:
88 SCell ssurfelXZ = K.sCell( Point( 5, 6, 5 ), false );
89 SCell ssurfelXY = K.sCell( Point( 5, 5, 6 ), false );
90 SCell ssurfelZY = K.sCell( Point( 6, 5, 5 ), false );
91 board << center;
92
93 SCell ssurfelXZo = K.sCell( Point( 5, 4, 5 ), false );
94 SCell ssurfelXYo = K.sCell( Point( 5, 5, 4 ), false );
95 SCell ssurfelZYo = K.sCell( Point( 4, 5, 5 ), false );
96
97 board << ssurfelXZ << ssurfelXY << ssurfelZY;
98 board << ssurfelXZo << ssurfelXYo << ssurfelZYo;
99
100 // Testing display oriented pointels
101
102 Cell pointelA = K.uCell(Point(2, 2, 2));
103 SCell pointelB = K.sCell(Point(4, 4, 4), true);
104 SCell pointelC = K.sCell(Point(6, 4, 4), false);
105 SCell linelAC = K.sCell(Point(5, 4, 4), false);
106 board << pointelA << pointelB << pointelC << linelAC;
107
108 /*board << CameraPosition(2.69044, 1.73705, -1.89961)
109 << CameraDirection(-0.515153, -0.212857, 0.830247)
110 << CameraUpVector(0.48806, -0.869135, 0.0800053);*/
111
112 board << CameraPosition(3.49239, 3.04746, -1.40276)
113 << CameraDirection(-0.605129, -0.454197, 0.653853)
114 << CameraUpVector(0.516135, -0.84913, -0.112173);
115
116 //board << SetMode3D(board.className(), "WireFrameMode");
117 board.saveCairo("dgtalBoard3DTo2D-KSCell.png", Board3DTo2D<Space, KSpace>::CairoPNG, 600, 400);
118
119}
120// //
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Definition: Board3DTo2D.h:71
std::string className() const
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
Cell uCell(const PreCell &c) const
From an unsigned cell, returns an unsigned cell lying into this Khalismky space.
Space::Point Point
Definition: StdDefs.h:168
Point center(const std::vector< Point > &points)
DGtal is the top-level namespace which contains all DGtal functions and types.
STL namespace.
CameraDirection class to set camera direction.
CameraPosition class to set camera position.
CameraUpVector class to set camera up-vector.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
int main(int argc, char **argv)
KSpace K
Domain domain