DGtal 1.3.0
Loading...
Searching...
No Matches
Functions
exampleGridCurve3d.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/geometry/curves/GridCurve.h"

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 73 of file exampleGridCurve3d.cpp.

74{
75
76
77 trace.info() << "exampleGridCurve3d: the type of data to be displayed "
78 << "may be given as argument as follows: "
79 << argv[0] << " scells" << endl;
80 trace.info() << "Available types are: gridcurve (default), scells, points, midpoints, arrows" << endl;
81
82 string type = (argc > 1) ? string(argv[1]) : "gridcurve";
83 trace.info() << "Chosen type: " << type << endl;
84
85 //curve
86 string sinus = examplesPath + "samples/sinus.dat";
87
88 // domain
89 Point lowerBound = Point::diagonal( -100 );
90 Point upperBound = Point::diagonal( 100 );
91
93 K3 ks; ks.init( lowerBound, upperBound, true );
94 GridCurve<K3> gc( ks );
96
98 fstream inputStream;
99 inputStream.open (sinus.c_str(), ios::in);
100
101 gc.initFromVectorStream(inputStream);
102
103 inputStream.close();
105
106 bool flag = false;
107#ifdef WITH_VISU3D_QGLVIEWER
108 QApplication application(argc,argv);
109 Viewer3D<Space,K3> viewer(ks);
110 viewer.show();
111
112 if (type == "gridcurve")
113 {
114 viewer << gc;
115 }
116 else if (type == "scells")
117 {
118 viewer << gc.getSCellsRange();
119 }
120 else if (type == "points")
121 {
122 viewer << gc.getPointsRange();
123 }
124 else if (type == "midpoints")
125 {
126 viewer << gc.getMidPointsRange();
127 }
128 else if (type == "arrows")
129 {
130 viewer << gc.getArrowsRange();
131 }
132 else
133 {
134 trace.info() << "Display type not known." << std::endl;
135 }
136 viewer << Viewer3D<Space,K3>::updateDisplay;
137 flag = application.exec();
138#endif
139
140 return flag;
141}
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition: GridCurve.h:173
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.
static Self diagonal(Component val=1)
std::ostream & info()
Trace trace
Definition: Common.h:154

References DGtal::PointVector< dim, Integer >::diagonal(), DGtal::GridCurve< TKSpace >::getArrowsRange(), DGtal::GridCurve< TKSpace >::getMidPointsRange(), DGtal::GridCurve< TKSpace >::getPointsRange(), DGtal::GridCurve< TKSpace >::getSCellsRange(), DGtal::Trace::info(), DGtal::KhalimskySpaceND< dim, TInteger >::init(), DGtal::GridCurve< TKSpace >::initFromVectorStream(), DGtal::Viewer3D< TSpace, TKSpace >::show(), and DGtal::trace.