DGtal  0.9.3
Functions
exampleArithDSS3d.cpp File Reference
#include <iostream>
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/boards/Board3DTo2D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/readers/PointListReader.h"
#include "DGtal/io/CDrawableWithDisplay3D.h"
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/geometry/curves/StandardDSS6Computer.h"
#include "DGtal/geometry/curves/GreedySegmentation.h"
Include dependency graph for exampleArithDSS3d.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
2011/06/01

This file is part of the DGtal library

Definition in file exampleArithDSS3d.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 72 of file exampleArithDSS3d.cpp.

References DGtal::PointVector< dim, TEuclideanRing, TContainer >::className(), and DGtal::Viewer3D< Space, KSpace >::show().

73 {
74 
75 
76  typedef PointVector<3,int> Point;
77  typedef std::vector<Point>::iterator Iterator;
78  typedef StandardDSS6Computer<Iterator,int,4> SegmentComputer;
79  typedef GreedySegmentation<SegmentComputer> Decomposition;
80 
81  string inputFilename = examplesPath + "samples/sinus.dat";
82  vector<Point> sequence = PointListReader<Point>::getPointsFromFile(inputFilename);
83 
84 
85  SegmentComputer algo;
86  Decomposition theDecomposition(sequence.begin(), sequence.end(), algo);
87 
89  //display
90  bool flag = true;
91  Point p;
92 
93 #ifdef WITH_VISU3D_QGLVIEWER
94 
95  QApplication application(argc,argv);
96  Viewer3D<> viewer;
97  viewer.show();
98  viewer << SetMode3D(p.className(), "Grid");
99 
100 #endif
101 #ifdef WITH_CAIRO
102  Board3DTo2D<> boardViewer;
103  boardViewer << SetMode3D(p.className(), "Grid");
104  boardViewer << CameraPosition(-23.500000, 12.500000, 42.078199)
105  << CameraDirection(0.7200000, -0.280000, -0.620000)
106  << CameraUpVector(0.1900000, 0.950000, -0.200000);
107  boardViewer << CameraZNearFar(21.578200, 105.578199);
108 #endif
109 
110 
111 
112  unsigned int c = 0;
113  Decomposition::SegmentComputerIterator i = theDecomposition.begin();
114  for ( ; i != theDecomposition.end(); ++i) {
115  SegmentComputer currentSegmentComputer(*i);
116  #ifdef WITH_VISU3D_QGLVIEWER
117  viewer << SetMode3D(currentSegmentComputer.className(), "Points");
118  viewer << currentSegmentComputer;
119  viewer << SetMode3D(currentSegmentComputer.className(), "BoundingBox");
120  viewer << currentSegmentComputer;
121  #endif
122  #ifdef WITH_CAIRO
123  boardViewer << SetMode3D(currentSegmentComputer.className(), "Points");
124  boardViewer << currentSegmentComputer;
125  boardViewer << SetMode3D(currentSegmentComputer.className(), "BoundingBox");
126  boardViewer << currentSegmentComputer;
127  #endif
128  c++;
129  }
130 
131 
132  #ifdef WITH_VISU3D_QGLVIEWER
133  viewer << Viewer3D<>::updateDisplay;
134  flag = application.exec();
135  #endif
136 
137  #ifdef WITH_CAIRO
138  boardViewer.saveCairo("exampleArithDSS3d.pdf", Board3DTo2D<>::CairoPDF, 600*2, 400*2);
139  #endif
140 
141  return flag;
142 }
CameraUpVector class to set camera up-vector.
CameraZNearFar class to set near and far distance.
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
Class for PDF, PNG, PS, EPS, SVG export drawings with Cairo with 3D->2D projection.
Definition: Common.h:145
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
CameraDirection class to set camera direction.
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
Aim: Computes the greedy segmentation of a range given by a pair of ConstIterators. The last element of a given segment is the first one one of the next segment.
Aim: Implements method to read a set of points represented in each line of a file.
CameraPosition class to set camera position.
MyPointD Point
Definition: testClone2.cpp:383
std::string className() const
Modifier class in a Display3D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithDisplay3D.