33 #include "DGtal/base/Common.h"
34 #include "DGtal/helpers/StdDefs.h"
35 #include "ConfigExamples.h"
37 #include "DGtal/geometry/curves/GridCurve.h"
39 #ifdef WITH_VISU3D_QGLVIEWER
40 #include <QtGui/qapplication.h>
41 #include "DGtal/io/viewers/Viewer3D.h"
42 #include "DGtal/io/DrawWithDisplay3DModifier.h"
48 using namespace DGtal;
52 #include <boost/program_options/options_description.hpp>
53 #include <boost/program_options/parsers.hpp>
54 #include <boost/program_options/variables_map.hpp>
56 namespace po = boost::program_options;
59 int main(
int argc,
char** argv )
63 po::options_description general_opt(
"Allowed options are");
64 general_opt.add_options()
65 (
"help,h",
"display this message")
66 (
"range,r", po::value<string>()->default_value(
"gridcurve"),
67 " Either <gridcurve> (default), <scells>, <points>, <midpoints>, <arrows> " );
70 po::store(po::parse_command_line(argc, argv, general_opt), vm);
74 trace.
info()<<
"exampleGridCurve3d" << std::endl
75 <<
"Basic usage: "<<std::endl
76 << argv[0] <<
" " << std::endl
77 << general_opt <<
"\n";
82 string type = vm[
"range"].as<
string>();
85 string sinus = examplesPath +
"samples/sinus.dat";
88 Point lowerBound = Point::diagonal( -100 );
89 Point upperBound = Point::diagonal( 100 );
92 K3 ks; ks.
init( lowerBound, upperBound,
true );
98 inputStream.open (sinus.c_str(), ios::in);
100 gc.initFromVectorStream(inputStream);
106 #ifdef WITH_VISU3D_QGLVIEWER
107 QApplication application(argc,argv);
111 if (type ==
"gridcurve")
115 else if (type ==
"scells")
117 viewer << gc.getSCellsRange();
119 else if (type ==
"points")
121 viewer << gc.getPointsRange();
123 else if (type ==
"midpoints")
125 viewer << gc.getMidPointsRange();
127 else if (type ==
"arrows")
129 viewer << gc.getArrowsRange();
133 trace.
info() <<
"Display type not known. Use option -h" << std::endl;
135 viewer << Viewer3D::updateDisplay;
136 flag = application.exec();