File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/config/TeX-MML-AM_CHTML/MathJax.js
DGtal 2.0.0
exampleGridCurve3d.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/geometry/curves/GridCurve.h"
Include dependency graph for exampleGridCurve3d.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Tristan Roussillon (trist.nosp@m.an.r.nosp@m.oussi.nosp@m.llon.nosp@m.@liri.nosp@m.s.cn.nosp@m.rs.fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2012/06/03

An example file for GridCurve, defined as a sequence of 1-scells, in a 3d Khalimsky space.

This file is part of the DGtal library.

Definition in file exampleGridCurve3d.cpp.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

[GridCurveDeclaration]

[GridCurveDeclaration]

[GridCurveFromDataFile]

[GridCurveFromDataFile]

Definition at line 71 of file exampleGridCurve3d.cpp.

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}
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition GridCurve.h:173
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)
KSpace K3
Definition StdDefs.h:147
Trace trace

References DGtal::PointVector< dim, Integer >::diagonal(), DGtal::GridCurve< TKSpace >::getArrowsRange(), DGtal::GridCurve< TKSpace >::getMidPointsRange(), DGtal::GridCurve< TKSpace >::getPointsRange(), DGtal::GridCurve< TKSpace >::getSCellsRange(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), DGtal::GridCurve< TKSpace >::initFromVectorStream(), DGtal::PolyscopeViewer< Space, KSpace >::show(), and DGtal::trace.