5 #ifdef BUILD_SHARED_LIBS 13 #define CATCH_CONFIG_MAIN 16 #include "../approx.h" 28 pose const POSE = { { {0,1,2}, {3,4,5}, {6,7,8} }, { 0,0,1 } };
29 rs2_extrinsics const EXTR = { { 0,1,2,3,4,5,6,7,8 }, {0,0,1} };
32 CHECK( 0 == memcmp( &POSE, &EXTR, 9 *
sizeof(
float ) ) );
34 CHECK( 0 == memcmp( &p, &EXTR, 9 *
sizeof(
float ) ) );
42 TEST_CASE(
"float3x3 operator()",
"[types]" )
44 float3x3 m = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
48 INFO(
"(0,0) " <<
m( 0, 0 ) <<
" (0,1) " <<
m( 0, 1 ) <<
" (0,2) " <<
m( 0, 2 ) );
49 INFO(
"(1,0) " <<
m( 1, 0 ) <<
" (1,1) " <<
m( 1, 1 ) <<
" (1,2) " <<
m( 1, 2 ) );
50 INFO(
"(2,0) " <<
m( 2, 0 ) <<
" (2,1) " <<
m( 2, 1 ) <<
" (2,2) " <<
m( 2, 2 ) );
63 return eq( a.
x, b.
x ) &&
eq( a.
y, b.
y ) &&
eq( a.
z, b.
z );
71 return eq( *(
pose const *)&a, *(
pose const *)&b );
76 return a.
x * b.
x + a.
y * b.
y + a.
z * b.
z;
88 float3x3 m = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
102 TEST_CASE(
"m*v (rotation matrix)",
"[types]" )
108 INFO(
"(0,0) " <<
m( 0, 0 ) <<
" (0,1) " <<
m( 0, 1 ) <<
" (0,2) " <<
m( 0, 2 ) );
109 INFO(
"(1,0) " <<
m( 1, 0 ) <<
" (1,1) " <<
m( 1, 1 ) <<
" (1,2) " <<
m( 1, 2 ) );
110 INFO(
"(2,0) " <<
m( 2, 0 ) <<
" (2,1) " <<
m( 2, 1 ) <<
" (2,2) " <<
m( 2, 2 ) );
119 return r.
x.
x * r.
y.
y * r.
z.
z 129 float3x3 I = { {1,0,0}, {0,1,0}, {0,0,1} };
135 INFO(
"\nrot=\n" << rot );
189 { 0.999899744987488f, 0.014070882461965f, -0.001586908474565f},
190 {-0.014017328619957f, 0.999457061290741f, 0.029818318784237f},
191 { 0.002005616901442f, -0.029793085530400f, 0.999554097652435f}
193 float3 tran = { -0.000100966520607471f, 0.013899585723876953f, -0.004260723590850830f };
195 auto p =
pose{ rot, tran };
197 INFO(
"\np= " << std::setprecision( 15 ) <<
p );
198 INFO(
"\ninv(p)= " << std::setprecision( 15 ) <<
inv(
p ) );
199 INFO(
"\ninverse(p)= " << std::setprecision( 15 ) <<
inverse(
p ) );
213 { 0.999899744987488f, 0.014070882461965f, -0.001586908474565f},
214 {-0.014017328619957f, 0.999457061290741f, 0.029818318784237f},
215 { 0.002005616901442f, -0.029793085530400f, 0.999554097652435f}
217 float3 tran = { -0.000100966520607471f, 0.013899585723876953f, -0.004260723590850830f };
218 auto p =
pose{ rot, tran };
220 INFO(
"\np= " << std::setprecision( 15 ) <<
p );
221 INFO(
"\ninv(p)= " << std::setprecision( 15 ) <<
inv(
p ) );
222 INFO(
"\ninv2(p)= " << std::setprecision( 15 ) <<
inv2(
p ) );
227 TEST_CASE(
"inverse of inverse (not a rot mat)",
"[types]" )
230 rs2_extrinsics extr{ { 0,1,2,3,4,5,6,7,8 }, {1,2,3} };
235 TEST_CASE(
"inverse of inverse (rot mat)",
"[types]" )
240 pose p = { rot, tran };
242 INFO(
"\np=\n" << std::setprecision( 15 ) << p );
243 INFO(
"\ninv(p)=\n" << std::setprecision( 15 ) <<
inv( p ) );
244 INFO(
"\ninv(inv(p))=\n" <<
inv(
inv( p ) ) );
249 TEST_CASE(
"inverse of inverse (extr)",
"[types]" )
252 { 0.999899744987488f, 0.014070882461965f, -0.001586908474565f},
253 {-0.014017328619957f, 0.999457061290741f, 0.029818318784237f},
254 { 0.002005616901442f, -0.029793085530400f, 0.999554097652435f}
256 float3 tran = { -0.000100966520607471f, 0.013899585723876953f, -0.004260723590850830f };
float3 mult(const float3x3 &a, const float3 &b)
GLboolean GLboolean GLboolean b
float determinant(float3x3 const &r)
rs2_extrinsics from_pose(pose a)
TEST_CASE("pose vs extrinsics","[types]")
GLboolean GLboolean GLboolean GLboolean a
float3x3 transpose(const float3x3 &a)
pose inverse(const pose &a)
pose to_pose(const rs2_extrinsics &a)
#define INITIALIZE_EASYLOGGINGPP
float dot(float3 const &a, float3 const &b)
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
bool eq(float3 const &a, float3 const &b)
CHECK_FALSE(inverse(inverse(p))==p)