ldpk
tde4_ldp_radial_fisheye_equisolid_deg_8.experimental.h
1 #pragma once
2 
3 #include <ldpk/tde4_ldp_radial_fisheye_base_deg_8.experimental.h>
4 
7 
10 template <class VEC2,class MAT2>
12  {
13 private:
14  typedef VEC2 vec2_type;
15  typedef MAT2 mat2_type;
17  using base_type::_fl_dn;
18  using base_type::_r_clip_factor;
19 protected:
20  void getBoundingBoxUndistort(double xa_in,double ya_in,double xb_in,double yb_in,double& xa_out,double& ya_out,double& xb_out,double& yb_out,int nx,int ny)
21  {
22  xa_out = 0.0;
23  ya_out = 0.0;
24  xb_out = 1.0;
25  yb_out = 1.0;
26  }
27  void getBoundingBoxDistort(double xa_in,double ya_in,double xb_in,double yb_in,double& xa_out,double& ya_out,double& xb_out,double& yb_out,int nx,int ny)
28  {
29  xa_out = 0.0;
30  ya_out = 0.0;
31  xb_out = 1.0;
32  yb_out = 1.0;
33  }
34  bool remap_fe2plain(double r_ed_dn,double& r_plain_dn)
35  {
36  typedef base_type bt;
37 // Angular elongation in equisolid lenses
38  double arg = r_ed_dn / (2.0 * _fl_dn);
39 // Equisolid has a maximum elongation of 180 degree.
40  if((arg >= 1) || (arg <= -1))
41  { return false; }
42  double theta = 2.0 * ::asin(arg);
43 // We can only visualize ]-90deg,+90deg[ in plain images.
44  if(theta >= M_PI / 2.0)
45  { return false; }
46 // Now remap to distance in plain filmback
47  r_plain_dn = _fl_dn * tan(theta);
48 // Optionally clip distance.
49  if(r_plain_dn > _r_clip_factor)
50  { r_plain_dn = _r_clip_factor; }
51  return true;
52  }
53  bool remap_plain2fe(double r_plain_dn,double& r_ed_dn)
54  {
55  typedef base_type bt;
56 // Angular elongation in gnomonic lenses: theta = arctan(r / f)
57  double theta = atan2(r_plain_dn,_fl_dn);
58 // Now remap to distance in equisolid lens
59  r_ed_dn = 2.0 * _fl_dn * ::sin(theta * (1.0/2.0));
60  return true;
61  }
62  bool getModelName(char *name)
63  {
64 #ifdef LDPK_COMPILE_AS_PLUGIN_SDV
65  strcpy(name,"3DE4 Radial - Fisheye, Equisolid, Degree 8 [Plugin]");
66 #else
67  strcpy(name,"3DE4 Radial - Fisheye, Equisolid, Degree 8");
68 #endif
69  return true;
70  }
71  };
Plugin class for radial distortion. Does not compensate for decentering.
Definition: tde4_ldp_radial_fisheye_base_deg_8.experimental.h:14
void getBoundingBoxUndistort(double xa_in, double ya_in, double xb_in, double yb_in, double &xa_out, double &ya_out, double &xb_out, double &yb_out, int nx, int ny)
Bounding box.
Definition: tde4_ldp_radial_fisheye_equisolid_deg_8.experimental.h:20
bool getModelName(char *name)
returns a name for the model as to show up in the GUI (maximum length of "name": 100 bytes)...
Definition: tde4_ldp_radial_fisheye_equisolid_deg_8.experimental.h:62
Plugin class for radial distortion. Does not compensate for decentering.
Definition: tde4_ldp_radial_fisheye_equisolid_deg_8.experimental.h:11
void getBoundingBoxDistort(double xa_in, double ya_in, double xb_in, double yb_in, double &xa_out, double &ya_out, double &xb_out, double &yb_out, int nx, int ny)
Iterate around the specified box, distort the points and compute the bounding box.
Definition: tde4_ldp_radial_fisheye_equisolid_deg_8.experimental.h:27