Dali 3D User Interface Engine
utc-Dali-AngleAxis.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #include <iostream>
19 #include <stdlib.h>
21 #include <dali-test-suite-utils.h>
22 
24 {
26 }
27 
29 {
31 }
32 
33 
34 
36 {
37  TestApplication application;
38 
39  AngleAxis a;
40  DALI_TEST_EQUALS(float(a.angle), 0.0f, 0.001f, TEST_LOCATION);
41  DALI_TEST_EQUALS(a.axis, Vector3(0.0f, 0.0f, 0.0f), 0.001f, TEST_LOCATION);
42  END_TEST;
43 }
44 
45 
46 
48 {
49  TestApplication application;
50 
51  Degree d(75.0f);
52  AngleAxis a(d, Vector3::XAXIS);
53 
54  DALI_TEST_EQUALS(a.angle, Radian(d), 0.001f, TEST_LOCATION);
55  DALI_TEST_EQUALS(a.axis, Vector3::XAXIS, 0.001f, TEST_LOCATION);
56  END_TEST;
57 }
58 
59 
61 {
62  TestApplication application;
63 
64  Radian r(Math::PI_2);
65  AngleAxis a(r, Vector3::ZAXIS);
66 
67  // AngleAxis stores its angle as a degree, so should only do degree comparison.
68  DALI_TEST_EQUALS(a.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
69  DALI_TEST_EQUALS(a.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
70  END_TEST;
71 }
72 
74 {
75  TestApplication application;
76 
77  Radian r(Math::PI_2);
78  AngleAxis a(r, Vector3::ZAXIS);
79 
80  AngleAxis b = a;
81 
82  // AngleAxis stores its angle as a degree, so should only do degree comparison.
83  DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
84  DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
85  END_TEST;
86 }
87 
89 {
90  TestApplication application;
91 
92  Radian r(Math::PI_2);
93  AngleAxis a(r, Vector3::ZAXIS);
94  AngleAxis b(a);
95 
96  // AngleAxis stores its angle as a degree, so should only do degree comparison.
97  DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
98  DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
99  END_TEST;
100 }
101 
103 {
104  TestApplication application;
105 
106  Radian r(Math::PI_2);
107  AngleAxis a(r, Vector3::ZAXIS);
108  AngleAxis b(a);
109 
110  tet_result((a == b) ? TET_PASS : TET_FAIL);
111 
112  b.axis = Vector3::YAXIS;
113  tet_result(!(a == b) ? TET_PASS : TET_FAIL);
114  END_TEST;
115 }
Dali Docs Home
Read more about Dali