Gazebo Rendering

API Reference

7.4.2
gz/rendering/CameraLens.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_RENDERING_CAMERALENS_HH_
19 #define GZ_RENDERING_CAMERALENS_HH_
20 
21 #include <memory>
22 
23 #include <gz/math/Vector3.hh>
24 #include <gz/utils/ImplPtr.hh>
25 
26 #include "gz/rendering/config.hh"
27 #include "gz/rendering/Export.hh"
28 
29 namespace gz
30 {
31  namespace rendering
32  {
33  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
34  //
36  enum GZ_RENDERING_VISIBLE MappingFunctionType
37  {
40 
43 
46 
49 
52 
55  };
56 
58  enum GZ_RENDERING_VISIBLE AngleFunctionType
59  {
62 
64  AFT_SIN = 1,
65 
67  AFT_TAN = 2
68  };
69 
72  class GZ_RENDERING_VISIBLE CameraLens
73  {
75  public: CameraLens();
76 
78  public: virtual ~CameraLens();
79 
82  public: explicit CameraLens(const CameraLens &_other);
83 
90  public: void SetCustomMappingFunction(double _c1, double _c2,
91  AngleFunctionType _fun, double _f, double _c3);
92 
95  public: MappingFunctionType Type() const;
96 
99  public: bool IsCustom() const;
100 
103  public: double C1() const;
104 
107  public: double C2() const;
108 
111  public: double C3() const;
112 
115  public: double F() const;
116 
119  public: AngleFunctionType AngleFunction() const;
120 
123  public: double CutOffAngle() const;
124 
127  public: bool ScaleToHFOV() const;
128 
131  public: void SetType(MappingFunctionType _type);
132 
135  public: void SetC1(double _c);
136 
139  public: void SetC2(double _c);
140 
143  public: void SetC3(double _c);
144 
147  public: void SetF(double _f);
148 
151  public: void SetAngleFunction(AngleFunctionType _fun);
152 
155  public: void SetCutOffAngle(double _angle);
156 
162  public: void SetScaleToHFOV(bool _scale);
163 
168  public: float ApplyMappingFunction(float _f) const;
169 
173  public: math::Vector3d MappingFunctionAsVector3d() const;
174 
177  public: CameraLens &operator=(const CameraLens &_other);
178 
181  private: void ConvertToCustom();
182 
185  GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
186  };
187  }
188  }
189 }
190 #endif