Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
digitalSetFromPointList.cpp
Go to the documentation of this file.
1
16
29
30
31
38
39
40
42#include "DGtal/base/Common.h"
43#include "DGtal/io/readers/PointListReader.h"
44#include "DGtal/io/viewers/PolyscopeViewer.h"
45#include "DGtal/io/Color.h"
46
47#include "DGtal/helpers/StdDefs.h"
48#include "ConfigExamples.h"
49
51
52using namespace std;
53using namespace DGtal;
54using namespace Z3i;
55
57
58int main( int argc, char** argv )
59{
60 std::string inputFilename = examplesPath + "samples/pointList3d.pl";
61 PolyscopeViewer<> viewer;
62 // Importing the 3d set of points contained with the default index (0, 1, 2);
63 vector<Z3i::Point> vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename);
64 for(unsigned int i=0; i<vectPoints.size();i++){
65 viewer << vectPoints.at(i);
66 }
67
68 // Importing the 3d set of points with another index definition (0, 2, 1);
69 vector<unsigned int> vPos;
70 vPos.push_back(0);
71 vPos.push_back(2);
72 vPos.push_back(1);
73 vectPoints= PointListReader<Z3i::Point>::getPointsFromFile(inputFilename, vPos);
74 viewer<< Color(255,0,0);
75 for(unsigned int i=0; i<vectPoints.size();i++){
76 viewer << vectPoints.at(i);
77 }
78
79 viewer.show();
80 return 0;
81}
82
Structure representing an RGB triple with alpha component.
Definition Color.h:77
void show() override
Starts the event loop and display of elements.
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.
static std::vector< TPoint > getPointsFromFile(const std::string &filename, std::vector< unsigned int > aVectPosition=std::vector< unsigned int >())
int main()
Definition testBits.cpp:56