ldpk
ldpk_rotation_extender.h
1 #ifndef ldpk_rotation_extender_sdv
2 #define ldpk_rotation_extender_sdv
3 
4 #include <ldpk/ldpk_extender_base.h>
5 
6 namespace ldpk
7  {
11  template <class VEC2,class MAT2>
12  class rotation_extender:public extender_base<VEC2,MAT2>
13  {
14  public:
15  typedef VEC2 vec2_type;
16  typedef MAT2 mat2_type;
17  private:
18  double _phi;
19  mat2_type _m_rot,_inv_m_rot;
20 
21  public:
23  {
24  _phi = 0.0;
25  _m_rot = mat2_type(1.0);
26  _inv_m_rot = mat2_type(1.0);
27  }
29  void set_phi(double phi)
30  {
31  _phi = phi;
32  _m_rot = mat2_type(cos(_phi),-sin(_phi),sin(_phi),cos(_phi));
33  _inv_m_rot = trans(_m_rot);
34  }
36  double get_phi() const
37  { return _phi; }
38 
40  vec2_type eval(const vec2_type& p) const
41  { return _m_rot * p; }
43  vec2_type eval_inv(const vec2_type& q) const
44  { return _inv_m_rot * q; }
46  vec2_type eval_inv(const vec2_type& q,const vec2_type& p_start) const
47  { return _inv_m_rot * q; }
49  const mat2_type& get_mat() const
50  { return _m_rot; }
52  const mat2_type& get_mat_inv() const
53  { return _inv_m_rot; }
54  };
55  }
56 
57 #endif
Base class of all extenders The concept of extenders as turned out to be useful in the new-style dist...
Definition: ldpk_extender_base.h:16
vec2_type eval(const vec2_type &p) const
eval() is per definition removal of lens distortion (undistort).
Definition: ldpk_rotation_extender.h:40
The namespace of (most of the) things related to the Lens Distortion Plugin Kit.
Definition: ldpk.h:180
The rotation extender simply rotates the incident ray around the optical axis. We need this e...
Definition: ldpk_rotation_extender.h:12
double get_phi() const
Getter.
Definition: ldpk_rotation_extender.h:36
vec2_type eval_inv(const vec2_type &q, const vec2_type &p_start) const
Generally (but not here), an initial value is needed for calculating the inverse. ...
Definition: ldpk_rotation_extender.h:46
const mat2_type & get_mat() const
The matrix for this extender.
Definition: ldpk_rotation_extender.h:49
const mat2_type & get_mat_inv() const
The inverse matrix for this extender.
Definition: ldpk_rotation_extender.h:52
vec2_type eval_inv(const vec2_type &q) const
eval_inv() is applying lens distortion (distort)
Definition: ldpk_rotation_extender.h:43
void set_phi(double phi)
The rotation extender has one parameter called phi (in radians).
Definition: ldpk_rotation_extender.h:29