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 "../../../quaternion.h"
24 float arr0[4] = {2344.98, 345.24, 456.12, 98.33};
25 float arr1[4] = {0.056, 0.34, -0.0076, 0.001};
27 vect<float> v0(4, arr0);
28 vect<float> v1(4, arr1);
30 quaternion<float> q0(v0);
31 quaternion<float> q1(v1);
32 quaternion<float> q2((float)2344.98, (float)345.24, (float)456.12, (float)98.33);
33 quaternion<float> q3(q1);
36 cout << "Constructor tests\n";
37 cout << "input\t" << v0 << "\n";
38 cout << "output\t" << q0.m_quat << "\n\n";
39 cout << "input\t" << v1 << "\n";
40 cout << "output\t" << q1.m_quat << "\n\n";
41 cout << "input\t" << v0 << "\n";
42 cout << "output\t" << q2.m_quat << "\n\n";
43 cout << "input\t" << v1 << "\n";
44 cout << "output\t" << q3.m_quat << "\n\n";
45 cout << "default constructor\n";
46 cout << "output\t" << q4.m_quat << "\n\n";
48 cout << "Multiplication\n";
50 quaternion<float> q5 = q0 * val;
51 cout << "input\t" << q0.m_quat << "\n" << 0.1 << "\n";
52 cout << "output\t" << q5.m_quat << "\n\n";
53 quaternion<float> q6 = q0 * q1;
54 cout << "input\t" << q0.m_quat << "\n" << q1.m_quat << "\n";
55 cout << "output\t" << q6.m_quat << "\n\n";
58 quaternion<float> q7 = q0 + q1;
59 cout << "input\t" << q0.m_quat << "\n" << q1.m_quat << "\n";
60 cout << "output\t" << q7.m_quat << "\n\n";
62 cout << "Quaternion Normalization\n";
63 cout << "input\t" << q1.m_quat << "\n";
65 cout << "output\t" << q1.m_quat << "\n\n";