4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #include "../../../euler_angles.h"
24 float arr0[3] = {234.98, 345.24, -56.12};
25 float arr1[3] = {56, -34, 76};
26 float arr2[4] = {0.6, 0.6, -.18, -.44};
27 float arr3[4] = {-0.5, -0.36, .43, .03};
29 vect<float,3> v0(arr0);
30 vect<float,3> v1(arr1);
31 vect<float,4> v2(arr2);
32 vect<float,4> v3(arr3);
34 quaternion<float> q1(v2);
35 quaternion<float> q2(v3);
37 euler_angles<float> e0(v0);
38 euler_angles<float> e1(v1);
39 euler_angles<float> e2((float)234.98, (float)345.24, (float)-56.12);
40 euler_angles<float> e3(e1);
41 euler_angles<float> e4;
43 cout << "Constructor tests\n";
44 cout << "input\t" << v0 << "\n";
45 cout << "output\t" << e0.m_ang << "\n\n";
46 cout << "input\t" << v1 << "\n";
47 cout << "output\t" << e1.m_ang << "\n\n";
48 cout << "input\t" << v0 << "\n";
49 cout << "output\t" << e2.m_ang << "\n\n";
50 cout << "input\t" << v1 << "\n";
51 cout << "output\t" << e3.m_ang << "\n\n";
52 cout << "default constructor\n";
53 cout << "output\t" << e4.m_ang << "\n\n";
55 cout << "Quaternion to Euler\n";
56 euler_angles<float> e5 = quat2euler(q1);
57 cout << "input\t" << q1.m_quat << "\n";
58 cout << "output\t" << e5.m_ang << "\n\n";
59 euler_angles<float> e8 = quat2euler(q2);
60 cout << "input\t" << q2.m_quat << "\n";
61 cout << "output\t" << e8.m_ang << "\n\n";
63 cout << "Euler to Quaternion\n";
64 quaternion<float> q3 = euler2quat(e8);
65 cout << "input\t" << e8.m_ang << "\n";
66 cout << "output\t" << q3.m_quat << "\n\n";
68 cout << "Radians to Degrees\n";
69 euler_angles<float> e6 = deg2rad(e0);
70 cout << "input\t" << e0.m_ang << "\n";
71 cout << "output\t" << e6.m_ang << "\n\n";
73 cout << "Degrees to Radians\n";
74 euler_angles<float> e7 = rad2deg(e6);
75 cout << "input\t" << e6.m_ang << "\n";
76 cout << "output\t" << e7.m_ang << "\n\n";