Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
exampleGridCurve3d.cpp
Go to the documentation of this file.
1
16
51
53#include <iostream>
54#include "DGtal/base/Common.h"
55#include "DGtal/helpers/StdDefs.h"
56#include "ConfigExamples.h"
57#include "DGtal/geometry/curves/GridCurve.h"
58
59#ifdef DGTAL_WITH_POLYSCOPE
60 #include "DGtal/io/viewers/PolyscopeViewer.h"
61#endif
63
64using namespace std;
65using namespace DGtal;
66using namespace Z3i;
67
68
69
71int main( int argc, char** argv )
72{
73
74
75 trace.info() << "exampleGridCurve3d: the type of data to be displayed "
76 << "may be given as argument as follows: "
77 << argv[0] << " scells" << endl;
78 trace.info() << "Available types are: gridcurve (default), scells, points, midpoints, arrows" << endl;
79
80 string type = (argc > 1) ? string(argv[1]) : "arrows";
81 trace.info() << "Chosen type: " << type << endl;
82
83 //curve
84 string sinus = examplesPath + "samples/sinus.dat";
85
86 // domain
87 Point lowerBound = Point::diagonal( -100 );
88 Point upperBound = Point::diagonal( 100 );
89
91 K3 ks; ks.init( lowerBound, upperBound, true );
92 GridCurve<K3> gc( ks );
94
96 fstream inputStream;
97 inputStream.open (sinus.c_str(), ios::in);
98
99 gc.initFromVectorStream(inputStream);
100
101 inputStream.close();
103
104#ifdef DGTAL_WITH_POLYSCOPE
105 PolyscopeViewer<Space,K3> viewer(ks);
106
107 if (type == "gridcurve")
108 {
109 viewer << gc;
110 }
111 else if (type == "scells")
112 {
113 viewer << gc.getSCellsRange();
114 }
115 else if (type == "points")
116 {
117 viewer << gc.getPointsRange();
118 }
119 else if (type == "midpoints")
120 {
121 viewer << gc.getMidPointsRange();
122 }
123 else if (type == "arrows")
124 {
125 viewer << gc.getArrowsRange();
126 }
127 else
128 {
129 trace.info() << "Display type not known." << std::endl;
130 }
131 viewer.show();
132#endif
133
134 return 0;
135}
136// //
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition GridCurve.h:173
SCellsRange getSCellsRange() const
Definition GridCurve.h:407
MidPointsRange getMidPointsRange() const
Definition GridCurve.h:430
bool initFromVectorStream(std::istream &in)
PointsRange getPointsRange() const
Definition GridCurve.h:418
ArrowsRange getArrowsRange() const
Definition GridCurve.h:442
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
static Self diagonal(Component val=1)
void show() override
Starts the event loop and display of elements.
Z3i this namespace gathers the standard of types for 3D imagery.
KSpace K3
Definition StdDefs.h:147
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
STL namespace.
int main()
Definition testBits.cpp:56