This file is indexed.

/usr/include/visp/vpSimulator.h is in libvisp-dev 2.9.0-3+b2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
/****************************************************************************
 *
 * $Id: vpSimulator.h 4574 2014-01-09 08:48:51Z fspindle $
 *
 * This file is part of the ViSP software.
 * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
 * 
 * This software is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * ("GPL") version 2 as published by the Free Software Foundation.
 * See the file LICENSE.txt at the root directory of this source
 * distribution for additional information about the GNU GPL.
 *
 * For using ViSP with software that can not be combined with the GNU
 * GPL, please contact INRIA about acquiring a ViSP Professional 
 * Edition License.
 *
 * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
 * 
 * This software was developed at:
 * INRIA Rennes - Bretagne Atlantique
 * Campus Universitaire de Beaulieu
 * 35042 Rennes Cedex
 * France
 * http://www.irisa.fr/lagadic
 *
 * If you have questions regarding the use of this file, please contact
 * INRIA at visp@inria.fr
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * Description:
 * Simulator based on Coin3d.
 *
 * Authors:
 * Eric Marchand
 * Anthony Saunier
 *
 *****************************************************************************/

#ifndef vpSimulator_HH
#define vpSimulator_HH
/*!
  \file vpSimulator.h
  \brief Implementation of a simulator based on Coin3d (www.coin3d.org).
  The simulator uses the vpViewer class.

  \warning The content of this file is only available if Coin3D and
  one of the GUI (SoWin, SoXT, SoQt) are installed.
*/
#include <visp/vpConfig.h>

#ifdef VISP_HAVE_COIN_AND_GUI

#include <visp/vpViewer.h>

/*   KNOWN ISSUE DEALING WITH X11 and QT
     If you get a strange compiler error on the line with None,
     it's probably because you're also including X11 headers,
     which #define the symbol None. Put the X11 includes after
     the Qt includes to solve this problem.
 */

#include <Inventor/nodes/SoBaseColor.h>
#include <Inventor/nodes/SoTransform.h>
#include <Inventor/nodes/SoCone.h>
#include <Inventor/nodes/SoCube.h>
#include <Inventor/nodes/SoImage.h>
#include <Inventor/nodes/SoLightModel.h>
#include <Inventor/nodes/SoPerspectiveCamera.h>
#include <Inventor/nodes/SoRotationXYZ.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoTranslation.h>
#include <Inventor/sensors/SoTimerSensor.h>
#include <Inventor/SoOffscreenRenderer.h>
#include <Inventor/fields/SoSFTime.h>
#include <Inventor/threads/SbThread.h>

// visp
#include <visp/vpDebug.h>
#include <visp/vpHomogeneousMatrix.h>
#include <visp/vpCameraParameters.h>
#include <visp/vpImage.h>
#include <visp/vpRGBa.h>
#include <visp/vpImageConvert.h>

/*!
  \class vpSimulator

  \ingroup RobotSimuWithViz
  
  \brief Implementation of a simulator based on Coin3d (www.coin3d.org).

  The simulator uses the vpViewer class.

  \warning This class is only available if Coin3D and one of the GUI
  (SoWin, SoXT, SoQt) are installed.
*/

class VISP_EXPORT vpSimulator
{
protected:
  //! perform some initialization
  void init() ;
  //! perform some destruction
  void kill() ;

public:
  //! constructor
  vpSimulator() ;
  virtual ~vpSimulator() ;

protected:
  //! main Widget
#if defined(VISP_HAVE_SOWIN)
  HWND mainWindow ;
#elif defined(VISP_HAVE_SOQT)
  QWidget * mainWindow ;
#elif defined(VISP_HAVE_SOXT)
  Widget mainWindow ;
#endif

  bool mainWindowInitialized ;

  //! open the SoGui application
  void initSoApplication() ;

public:
  typedef enum  {
    grayImage,
    colorImage
  } vpImageType ;
  vpImageType typeImage ;

  GLubyte * image_background;
  //! activate the mainloop
  virtual   void mainLoop() ;

protected:
  //! view from the camera
  vpViewer *internalView ;
  //! view from an external camera
  vpViewer *externalView ;

public:
  //! initialize the camera view
  virtual void initInternalViewer(const unsigned int nlig, const unsigned int ncol) ;
  //! initialize the external view
  void initExternalViewer(const unsigned int nlig, const unsigned int ncol) ;

protected:
  //! thread with the main program
  SbThread * mainThread;
  //pthread_t mainThread;

public:
  //! begin the main program
  void initApplication(void *(*start_routine)(void *)) ;
  void initApplication(void *(*start_routine)(void *), void* data);
  //! perform some initialization in the main program thread
  void initMainApplication() ;
  void closeMainApplication() ;

  //----------------------------------------------------
  // scene description
protected:
  unsigned int internal_width;
  unsigned int internal_height;
  unsigned int external_width;
  unsigned int external_height;

public:
  /*!
    Return the width of the internal view. 
    
    \return The width of the internal view.
  */
  unsigned int getInternalWidth() const { return internal_width; }
  /*!
    Return the height of the internal view. 
    
    \return The height of the internal view.
  */
  unsigned int getInternalHeight() const { return internal_height; }

protected:
  //! root node of the scene : contains everything except stuff specific to
  //! each view
  SoSeparator *scene;
  //! root node of the internal view
  SoSeparator *internalRoot;
  //! root node of the external view
  SoSeparator *externalRoot;

  //! internal camera
  SoPerspectiveCamera *internalCamera ;
  //! external camera
  SoPerspectiveCamera *externalCamera ;

  //! internal camera position
  SoTransform *internalCameraPosition ;

  //! external camera position
  SoTransform *extrenalCameraPosition ;

  //! representation of the camera in the external view
  SoSeparator *internalCameraObject;

  //! initialize the scene graph
  void initSceneGraph() ;

  //!Add a new object in the scene graph ad a given location
  void addObject(SoSeparator * object, const vpHomogeneousMatrix &fMo,
		 SoSeparator * root) ;

public :
  //!Add a new object in the scene graph ad a given location
  void addObject(SoSeparator * newObject, const vpHomogeneousMatrix &fMo) ;

public:
  //! display the scene (handle with care)
  void redraw() ;
  //! load an iv file
  void load(const char *file_name) ;
  //! load an iv file, set the location of this scene
  void load(const char *iv_filename,const vpHomogeneousMatrix &fMo) ;
  //! save the scene in an iv file
  void save(const char *name,bool binary=false) ;

  //!   Add the representation of the absolute frame
  void addAbsoluteFrame (float zoom=1) ;
  //!   Add the representation of a frame
  void addFrame (const vpHomogeneousMatrix &fMo, float zoom=1) ;
  //! set the size of the camera/frame
  void setZoomFactor (const float zoom) ;

protected:
  float zoomFactor ;
  //---------------------------------------------------
  //  camera description
protected:
  bool cameraPositionInitialized ;
  //! internal camera position
  vpHomogeneousMatrix cMf ;
  //! internal camera parameters
  vpCameraParameters internalCameraParameters ;
  //! internal camera parameters
  vpCameraParameters externalCameraParameters ;

public:
  //! set the camera position (from an homogeneous matrix)
  void setCameraPosition(vpHomogeneousMatrix &cMf) ;
  //! get the camera position (from an homogeneous matrix)
  void getCameraPosition(vpHomogeneousMatrix &_cMf) { _cMf = cMf ; }
  //! modify the position of the camera in the scene graph
  void moveInternalCamera(vpHomogeneousMatrix &cMf) ;
  //! set internal camera parameters
  void setInternalCameraParameters(vpCameraParameters &cam) ;
  //! set external camera parameters
  void setExternalCameraParameters(vpCameraParameters &cam) ;
  //! get the external camera position
  void getExternalCameraPosition(vpHomogeneousMatrix &cMf) ;

  //! get an Image of the internal view 
  void getInternalImage(vpImage<unsigned char> &I) ;
  //! get an Image of the internal view 
  void getInternalImage(vpImage<vpRGBa> &I) ;
  /* --- Off screen rendering  --- */
  
  void changeZoomFactor(const float zoom, const int index);
public:
  typedef enum { INTERNAL, EXTERNAL } vpSimulatorViewType ;
  void  write(const char * fileName);
protected:
  SbTime * realtime ;
  SoOffscreenRenderer * offScreenRenderer ;
  void offScreenRendering (vpSimulatorViewType view=vpSimulator::EXTERNAL,
			   int * width = NULL,
			   int * height = NULL);
public:
  //! image of the internal view
  unsigned char * bufferView;

  //! Flag to protect the read and write of the framebuffer (between the simulator and the viewer).
  int get ;
public:
  //! get the image corresponding to the internal view
  unsigned char* getBufferedOffScreenRenderer()
  {
    return bufferView;
  }

  //! get the size of the internal view
  void getSizeInternalView(int& width, int& height);

  //! get the intrinsic parameters of the camera
  void getCameraParameters(vpCameraParameters &cam)
  {
    cam = internalCameraParameters;
  }
} ;


#endif
#endif