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 
20  bool remap_fe2plain(double r_ed_dn,double& r_plain_dn)
21  {
22  typedef base_type bt;
23  bool rc = true;
24 // Angular elongation in equisolid lenses
25  double arg = r_ed_dn / (2.0 * _fl_dn);
26 // Equisolid has a maximum elongation of 180 degree.
27  if((arg >= 1) || (arg <= -1))
28  { return false; }
29  double theta = 2.0 * ::asin(arg);
30 // We can only visualize ]-90deg,+90deg[ in plain images.
31  if(theta >= M_PI / 2.0)
32  { return false; }
33 // Now remap to distance in plain filmback
34  r_plain_dn = _fl_dn * tan(theta);
35 // Optionally clip distance.
36  if(r_plain_dn > _r_clip_factor)
37  { r_plain_dn = _r_clip_factor; }
38  return true;
39  }
40  bool remap_plain2fe(double r_plain_dn,double& r_ed_dn)
41  {
42  typedef base_type bt;
43 // Angular elongation in gnomonic lenses: theta = arctan(r / f)
44  double theta = atan2(r_plain_dn,_fl_dn);
45 // Now remap to distance in equisolid lens
46  r_ed_dn = 2.0 * _fl_dn * ::sin(theta * (1.0/2.0));
47  return true;
48  }
49  bool getModelName(char *name)
50  {
51 #ifdef LDPK_COMPILE_AS_PLUGIN_SDV
52  strcpy(name,"3DE4 Radial - Fisheye, Equisolid, Degree 8 [Plugin]");
53 #else
54  strcpy(name,"3DE4 Radial - Fisheye, Equisolid, Degree 8");
55 #endif
56  return true;
57  }
58  };
Plugin class for radial distortion. Does not compensate for decentering.
Definition: tde4_ldp_radial_fisheye_base_deg_8.experimental.h:14
Plugin class for radial distortion. Does not compensate for decentering.
Definition: tde4_ldp_radial_fisheye_equisolid_deg_8.experimental.h:11