DGtal  1.5.beta
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 74 of file exampleArithDSS3d.cpp.

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

References DGtal::Board3DTo2D< Space, KSpace >::saveCairo(), and DGtal::Viewer3D< TSpace, TKSpace >::show().