Visual Servoing Platform  version 3.6.1 under development (2024-12-13)
vpPanda3DRenderParameters.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  */
30 
31 #ifndef VP_PANDA3D_RENDER_PARAMETERS_H
32 #define VP_PANDA3D_RENDER_PARAMETERS_H
33 
34 #include <visp3/core/vpConfig.h>
35 
36 #if defined(VISP_HAVE_PANDA3D)
37 #include <visp3/core/vpCameraParameters.h>
38 
39 class Camera;
40 
41 BEGIN_VISP_NAMESPACE
50 class VISP_EXPORT vpPanda3DRenderParameters
51 {
52 public:
53  vpPanda3DRenderParameters() : m_cam(), m_height(0), m_width(0), m_clipNear(0.001), m_clipFar(10.0) { }
54  vpPanda3DRenderParameters(const vpCameraParameters &cam, unsigned int h, unsigned int w,
55  double clipNear, double clipFar)
56  : m_cam(cam), m_height(h), m_width(w), m_clipNear(clipNear), m_clipFar(clipFar)
57  { }
58 
64  const vpCameraParameters &getCameraIntrinsics() const { return m_cam; }
70  {
72  throw vpException(vpException::badValue, "Panda3D renderer: only lenses with no distortion are supported");
73  }
74  m_cam = cam;
75  }
76 
77  double getNearClippingDistance() const { return m_clipNear; }
78  double getFarClippingDistance() const { return m_clipFar; }
79 
86  void setClippingDistance(double nearV, double farV)
87  {
88  if (farV < nearV) {
89  std::swap(nearV, farV);
90  }
91  m_clipNear = nearV;
92  m_clipFar = farV;
93  }
94 
95  unsigned int getImageWidth() const { return m_width; }
96  unsigned int getImageHeight() const { return m_height; }
97 
106  void setImageResolution(unsigned int height, unsigned int width)
107  {
108  m_height = height;
109  m_width = width;
110  }
111 
119  void setupPandaCamera(Camera *camera);
120 
121 private:
122  vpCameraParameters m_cam;
123  unsigned int m_height, m_width;
124  double m_clipNear, m_clipFar;
125 };
126 
127 END_VISP_NAMESPACE
128 #endif
129 #endif
Generic class defining intrinsic camera parameters.
@ perspectiveProjWithoutDistortion
Perspective projection without distortion model.
vpCameraParametersProjType get_projModel() const
error that can be emitted by ViSP classes.
Definition: vpException.h:60
@ badValue
Used to indicate that a value is not in the allowed range.
Definition: vpException.h:73
Rendering parameters for a panda3D simulation.
void setClippingDistance(double nearV, double farV)
Set the clipping distance. When a panda camera uses these render parameters, objects that are closer ...
void setCameraIntrinsics(const vpCameraParameters &cam)
set camera intrinsics. Only camera intrinsics for a lens without distortion are supported.
const vpCameraParameters & getCameraIntrinsics() const
Retrieve camera intrinsics.
vpPanda3DRenderParameters(const vpCameraParameters &cam, unsigned int h, unsigned int w, double clipNear, double clipFar)
void setImageResolution(unsigned int height, unsigned int width)
Set the image resolution. When this object is given to a vpPanda3DBaseRenderer, this will be the reso...