14 namespace depth_to_rgb_calibration {
21 auto sin_a = sin( rot_angles.
alpha );
22 auto sin_b = sin( rot_angles.
beta );
23 auto sin_g = sin( rot_angles.
gamma );
25 auto cos_a = cos( rot_angles.
alpha );
26 auto cos_b = cos( rot_angles.
beta );
27 auto cos_g = cos( rot_angles.
gamma );
36 res.
rot[0] = cos_b * cos_g;
37 res.
rot[3] = -cos_b * sin_g;
39 res.
rot[1] = cos_a * sin_g + cos_g * sin_a*sin_b;
40 res.
rot[4] = cos_a * cos_g - sin_a * sin_b*sin_g;
41 res.
rot[7] = -cos_b * sin_a;
42 res.
rot[2] = sin_a * sin_g - cos_a * cos_g*sin_b;
43 res.
rot[5] = cos_g * sin_a + cos_a * sin_b*sin_g;
44 res.
rot[8] = cos_a * cos_b;
53 return r[0] * r[4] * r[8]
69 return{ a*b.
x, a*b.y, a*b.z };
81 res.
alpha = atan2( -r[7], r[8] );
82 res.
beta = asin( r[6] );
83 res.
gamma = atan2( -r[3], r[0] );
90 double const epsilon = 1
e-8;
93 std::ostringstream ss;
94 ss << std::setprecision( 15 );
95 ss <<
"angles_from_rotation != rotation_from_angles!";
96 ss <<
"\n " << r[0] <<
" " << r[1] <<
" " << r[2]
97 <<
"\n " << r[3] <<
" " << r[4] <<
" " << r[5]
98 <<
"\n " << r[6] <<
" " << r[7] <<
" " << r[8];
100 <<
"\n " << rot.rot[0] <<
" " << rot.rot[1] <<
" " << rot.rot[2]
101 <<
"\n " << rot.rot[3] <<
" " << rot.rot[4] <<
" " << rot.rot[5]
102 <<
"\n " << rot.rot[6] <<
" " << rot.rot[7] <<
" " << rot.rot[8];
104 <<
"\n alpha= " << res.
alpha 105 <<
"\n beta = " << res.
beta 106 <<
"\n gamma= " << res.
gamma;
107 ss <<
"\nsum= " << sum;
108 throw std::runtime_error( ss.str() );
rotation_in_angles extract_angles_from_rotation(const double r[9])
GLboolean GLboolean GLboolean b
float determinant(float3x3 const &r)
float3 operator*(const float3 &a, float b)
GLboolean GLboolean GLboolean GLboolean a
float dot(float3 const &a, float3 const &b)
matrix_3x3 extract_rotation_from_angles(const rotation_in_angles &rot_angles)