18 #ifndef _GAZEBO_RENDERING_CAMERA_LENS_PRIVATE_HH_
19 #define _GAZEBO_RENDERING_CAMERA_LENS_PRIVATE_HH_
28 #include <ignition/math.hh>
29 #include <ignition/math/Vector3.hh>
39 class WideAngleCamera;
45 public:
double c1 = 1.0;
48 public:
double c2 = 1.0;
51 public:
double c3 = 0.0;
54 public:
double f = 1.0;
66 for (
auto item : variants)
68 if (std::get<0>(item) == _str)
76 throw std::invalid_argument(
"Unknown function ["+_str+
"]");
85 return std::get<1>(value);
92 return std::get<0>(value);
97 public:
float Apply(
const float _t)
99 return std::get<2>(value)(_t);
107 this->value = _fun.value;
113 private:
const std::vector<
114 std::tuple<std::string, ignition::math::Vector3d,
115 std::function<float (float)> > > variants = {
116 std::make_tuple(
"sin",
117 ignition::math::Vector3d::UnitX,
118 std::function<
float (
float)>(
119 static_cast<float (*)(
float)
>(&std::sin))),
120 std::make_tuple(
"tan",
121 ignition::math::Vector3d::UnitY,
122 std::function<
float (
float)>(
123 static_cast<float (*)(
float)
>(&std::tan))),
124 std::make_tuple(
"id",
125 ignition::math::Vector3d::UnitZ,
126 std::function<
float (
float)>(
133 private: decltype(variants)::value_type value;
141 public: sdf::ElementPtr
sdf;
MapFunctionEnum & operator=(const MapFunctionEnum &_fun)
Assignment operator.
Definition: CameraLensPrivate.hh:105
Enumeration of functions that can be casted to some other types.
Definition: CameraLensPrivate.hh:60
MapFunctionEnum(const std::string &_str)
Constructor.
Definition: CameraLensPrivate.hh:64
MapFunctionEnum fun
fun component of the mapping function,
Definition: CameraLensPrivate.hh:138
std::string AsString() const
Cast to std::string.
Definition: CameraLensPrivate.hh:90
std::recursive_mutex dataMutex
Mutex to lock when getting or setting lens data.
Definition: CameraLensPrivate.hh:144
ignition::math::Vector3d AsVector3d() const
Cast to ignition::math::Vector3d, this vector is passed to shader to avoid branching.
Definition: CameraLensPrivate.hh:83
double c3
Angle offset factor.
Definition: CameraLensPrivate.hh:51
double c1
Linear scale factor.
Definition: CameraLensPrivate.hh:45
double f
Linear scale factor, may be adjusted in runtime.
Definition: CameraLensPrivate.hh:54
float Apply(const float _t)
Apply function to float value.
Definition: CameraLensPrivate.hh:97
sdf::ElementPtr sdf
SDF element of the lens.
Definition: CameraLensPrivate.hh:141
double c2
Angle scale factor.
Definition: CameraLensPrivate.hh:48
double cutOffAngle
Visible field of view.
Definition: CameraLensPrivate.hh:57
Private fields of camera lens.
Definition: CameraLensPrivate.hh:42