test_basis.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. /**************************************************************************/
  2. /* test_basis.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef TEST_BASIS_H
  31. #define TEST_BASIS_H
  32. #include "core/math/basis.h"
  33. #include "core/math/random_number_generator.h"
  34. #include "tests/test_macros.h"
  35. namespace TestBasis {
  36. Vector3 deg_to_rad(const Vector3 &p_rotation) {
  37. return p_rotation / 180.0 * Math_PI;
  38. }
  39. Vector3 rad2deg(const Vector3 &p_rotation) {
  40. return p_rotation / Math_PI * 180.0;
  41. }
  42. String get_rot_order_name(EulerOrder ro) {
  43. switch (ro) {
  44. case EulerOrder::XYZ:
  45. return "XYZ";
  46. case EulerOrder::XZY:
  47. return "XZY";
  48. case EulerOrder::YZX:
  49. return "YZX";
  50. case EulerOrder::YXZ:
  51. return "YXZ";
  52. case EulerOrder::ZXY:
  53. return "ZXY";
  54. case EulerOrder::ZYX:
  55. return "ZYX";
  56. default:
  57. return "[Not supported]";
  58. }
  59. }
  60. void test_rotation(Vector3 deg_original_euler, EulerOrder rot_order) {
  61. // This test:
  62. // 1. Converts the rotation vector from deg to rad.
  63. // 2. Converts euler to basis.
  64. // 3. Converts the above basis back into euler.
  65. // 4. Converts the above euler into basis again.
  66. // 5. Compares the basis obtained in step 2 with the basis of step 4
  67. //
  68. // The conversion "basis to euler", done in the step 3, may be different from
  69. // the original euler, even if the final rotation are the same.
  70. // This happens because there are more ways to represents the same rotation,
  71. // both valid, using eulers.
  72. // For this reason is necessary to convert that euler back to basis and finally
  73. // compares it.
  74. //
  75. // In this way we can assert that both functions: basis to euler / euler to basis
  76. // are correct.
  77. // Euler to rotation
  78. const Vector3 original_euler = deg_to_rad(deg_original_euler);
  79. const Basis to_rotation = Basis::from_euler(original_euler, rot_order);
  80. // Euler from rotation
  81. const Vector3 euler_from_rotation = to_rotation.get_euler(rot_order);
  82. const Basis rotation_from_computed_euler = Basis::from_euler(euler_from_rotation, rot_order);
  83. Basis res = to_rotation.inverse() * rotation_from_computed_euler;
  84. CHECK_MESSAGE((res.get_column(0) - Vector3(1.0, 0.0, 0.0)).length() <= 0.001, vformat("Fail due to X %s\n", String(res.get_column(0))));
  85. CHECK_MESSAGE((res.get_column(1) - Vector3(0.0, 1.0, 0.0)).length() <= 0.001, vformat("Fail due to Y %s\n", String(res.get_column(1))));
  86. CHECK_MESSAGE((res.get_column(2) - Vector3(0.0, 0.0, 1.0)).length() <= 0.001, vformat("Fail due to Z %s\n", String(res.get_column(2))));
  87. // Double check `to_rotation` decomposing with XYZ rotation order.
  88. const Vector3 euler_xyz_from_rotation = to_rotation.get_euler(EulerOrder::XYZ);
  89. Basis rotation_from_xyz_computed_euler = Basis::from_euler(euler_xyz_from_rotation, EulerOrder::XYZ);
  90. res = to_rotation.inverse() * rotation_from_xyz_computed_euler;
  91. CHECK_MESSAGE((res.get_column(0) - Vector3(1.0, 0.0, 0.0)).length() <= 0.001, vformat("Double check with XYZ rot order failed, due to X %s\n", String(res.get_column(0))));
  92. CHECK_MESSAGE((res.get_column(1) - Vector3(0.0, 1.0, 0.0)).length() <= 0.001, vformat("Double check with XYZ rot order failed, due to Y %s\n", String(res.get_column(1))));
  93. CHECK_MESSAGE((res.get_column(2) - Vector3(0.0, 0.0, 1.0)).length() <= 0.001, vformat("Double check with XYZ rot order failed, due to Z %s\n", String(res.get_column(2))));
  94. INFO(vformat("Rotation order: %s\n.", get_rot_order_name(rot_order)));
  95. INFO(vformat("Original Rotation: %s\n", String(deg_original_euler)));
  96. INFO(vformat("Quaternion to rotation order: %s\n", String(rad2deg(euler_from_rotation))));
  97. }
  98. TEST_CASE("[Basis] Euler conversions") {
  99. Vector<EulerOrder> euler_order_to_test;
  100. euler_order_to_test.push_back(EulerOrder::XYZ);
  101. euler_order_to_test.push_back(EulerOrder::XZY);
  102. euler_order_to_test.push_back(EulerOrder::YZX);
  103. euler_order_to_test.push_back(EulerOrder::YXZ);
  104. euler_order_to_test.push_back(EulerOrder::ZXY);
  105. euler_order_to_test.push_back(EulerOrder::ZYX);
  106. Vector<Vector3> vectors_to_test;
  107. // Test the special cases.
  108. vectors_to_test.push_back(Vector3(0.0, 0.0, 0.0));
  109. vectors_to_test.push_back(Vector3(0.5, 0.5, 0.5));
  110. vectors_to_test.push_back(Vector3(-0.5, -0.5, -0.5));
  111. vectors_to_test.push_back(Vector3(40.0, 40.0, 40.0));
  112. vectors_to_test.push_back(Vector3(-40.0, -40.0, -40.0));
  113. vectors_to_test.push_back(Vector3(0.0, 0.0, -90.0));
  114. vectors_to_test.push_back(Vector3(0.0, -90.0, 0.0));
  115. vectors_to_test.push_back(Vector3(-90.0, 0.0, 0.0));
  116. vectors_to_test.push_back(Vector3(0.0, 0.0, 90.0));
  117. vectors_to_test.push_back(Vector3(0.0, 90.0, 0.0));
  118. vectors_to_test.push_back(Vector3(90.0, 0.0, 0.0));
  119. vectors_to_test.push_back(Vector3(0.0, 0.0, -30.0));
  120. vectors_to_test.push_back(Vector3(0.0, -30.0, 0.0));
  121. vectors_to_test.push_back(Vector3(-30.0, 0.0, 0.0));
  122. vectors_to_test.push_back(Vector3(0.0, 0.0, 30.0));
  123. vectors_to_test.push_back(Vector3(0.0, 30.0, 0.0));
  124. vectors_to_test.push_back(Vector3(30.0, 0.0, 0.0));
  125. vectors_to_test.push_back(Vector3(0.5, 50.0, 20.0));
  126. vectors_to_test.push_back(Vector3(-0.5, -50.0, -20.0));
  127. vectors_to_test.push_back(Vector3(0.5, 0.0, 90.0));
  128. vectors_to_test.push_back(Vector3(0.5, 0.0, -90.0));
  129. vectors_to_test.push_back(Vector3(360.0, 360.0, 360.0));
  130. vectors_to_test.push_back(Vector3(-360.0, -360.0, -360.0));
  131. vectors_to_test.push_back(Vector3(-90.0, 60.0, -90.0));
  132. vectors_to_test.push_back(Vector3(90.0, 60.0, -90.0));
  133. vectors_to_test.push_back(Vector3(90.0, -60.0, -90.0));
  134. vectors_to_test.push_back(Vector3(-90.0, -60.0, -90.0));
  135. vectors_to_test.push_back(Vector3(-90.0, 60.0, 90.0));
  136. vectors_to_test.push_back(Vector3(90.0, 60.0, 90.0));
  137. vectors_to_test.push_back(Vector3(90.0, -60.0, 90.0));
  138. vectors_to_test.push_back(Vector3(-90.0, -60.0, 90.0));
  139. vectors_to_test.push_back(Vector3(60.0, 90.0, -40.0));
  140. vectors_to_test.push_back(Vector3(60.0, -90.0, -40.0));
  141. vectors_to_test.push_back(Vector3(-60.0, -90.0, -40.0));
  142. vectors_to_test.push_back(Vector3(-60.0, 90.0, 40.0));
  143. vectors_to_test.push_back(Vector3(60.0, 90.0, 40.0));
  144. vectors_to_test.push_back(Vector3(60.0, -90.0, 40.0));
  145. vectors_to_test.push_back(Vector3(-60.0, -90.0, 40.0));
  146. vectors_to_test.push_back(Vector3(-90.0, 90.0, -90.0));
  147. vectors_to_test.push_back(Vector3(90.0, 90.0, -90.0));
  148. vectors_to_test.push_back(Vector3(90.0, -90.0, -90.0));
  149. vectors_to_test.push_back(Vector3(-90.0, -90.0, -90.0));
  150. vectors_to_test.push_back(Vector3(-90.0, 90.0, 90.0));
  151. vectors_to_test.push_back(Vector3(90.0, 90.0, 90.0));
  152. vectors_to_test.push_back(Vector3(90.0, -90.0, 90.0));
  153. vectors_to_test.push_back(Vector3(20.0, 150.0, 30.0));
  154. vectors_to_test.push_back(Vector3(20.0, -150.0, 30.0));
  155. vectors_to_test.push_back(Vector3(-120.0, -150.0, 30.0));
  156. vectors_to_test.push_back(Vector3(-120.0, -150.0, -130.0));
  157. vectors_to_test.push_back(Vector3(120.0, -150.0, -130.0));
  158. vectors_to_test.push_back(Vector3(120.0, 150.0, -130.0));
  159. vectors_to_test.push_back(Vector3(120.0, 150.0, 130.0));
  160. vectors_to_test.push_back(Vector3(89.9, 0.0, 0.0));
  161. vectors_to_test.push_back(Vector3(-89.9, 0.0, 0.0));
  162. vectors_to_test.push_back(Vector3(0.0, 89.9, 0.0));
  163. vectors_to_test.push_back(Vector3(0.0, -89.9, 0.0));
  164. vectors_to_test.push_back(Vector3(0.0, 0.0, 89.9));
  165. vectors_to_test.push_back(Vector3(0.0, 0.0, -89.9));
  166. for (int h = 0; h < euler_order_to_test.size(); h += 1) {
  167. for (int i = 0; i < vectors_to_test.size(); i += 1) {
  168. test_rotation(vectors_to_test[i], euler_order_to_test[h]);
  169. }
  170. }
  171. }
  172. TEST_CASE("[Stress][Basis] Euler conversions") {
  173. Vector<EulerOrder> euler_order_to_test;
  174. euler_order_to_test.push_back(EulerOrder::XYZ);
  175. euler_order_to_test.push_back(EulerOrder::XZY);
  176. euler_order_to_test.push_back(EulerOrder::YZX);
  177. euler_order_to_test.push_back(EulerOrder::YXZ);
  178. euler_order_to_test.push_back(EulerOrder::ZXY);
  179. euler_order_to_test.push_back(EulerOrder::ZYX);
  180. Vector<Vector3> vectors_to_test;
  181. // Add 1000 random vectors with weirds numbers.
  182. RandomNumberGenerator rng;
  183. for (int _ = 0; _ < 1000; _ += 1) {
  184. vectors_to_test.push_back(Vector3(
  185. rng.randf_range(-1800, 1800),
  186. rng.randf_range(-1800, 1800),
  187. rng.randf_range(-1800, 1800)));
  188. }
  189. for (int h = 0; h < euler_order_to_test.size(); h += 1) {
  190. for (int i = 0; i < vectors_to_test.size(); i += 1) {
  191. test_rotation(vectors_to_test[i], euler_order_to_test[h]);
  192. }
  193. }
  194. }
  195. TEST_CASE("[Basis] Set axis angle") {
  196. Vector3 axis;
  197. real_t angle;
  198. real_t pi = (real_t)Math_PI;
  199. // Testing the singularity when the angle is 0°.
  200. Basis identity(1, 0, 0, 0, 1, 0, 0, 0, 1);
  201. identity.get_axis_angle(axis, angle);
  202. CHECK(angle == 0);
  203. // Testing the singularity when the angle is 180°.
  204. Basis singularityPi(-1, 0, 0, 0, 1, 0, 0, 0, -1);
  205. singularityPi.get_axis_angle(axis, angle);
  206. CHECK(angle == doctest::Approx(pi));
  207. // Testing reversing the an axis (of an 30° angle).
  208. float cos30deg = Math::cos(Math::deg_to_rad((real_t)30.0));
  209. Basis z_positive(cos30deg, -0.5, 0, 0.5, cos30deg, 0, 0, 0, 1);
  210. Basis z_negative(cos30deg, 0.5, 0, -0.5, cos30deg, 0, 0, 0, 1);
  211. z_positive.get_axis_angle(axis, angle);
  212. CHECK(angle == doctest::Approx(Math::deg_to_rad((real_t)30.0)));
  213. CHECK(axis == Vector3(0, 0, 1));
  214. z_negative.get_axis_angle(axis, angle);
  215. CHECK(angle == doctest::Approx(Math::deg_to_rad((real_t)30.0)));
  216. CHECK(axis == Vector3(0, 0, -1));
  217. // Testing a rotation of 90° on x-y-z.
  218. Basis x90deg(1, 0, 0, 0, 0, -1, 0, 1, 0);
  219. x90deg.get_axis_angle(axis, angle);
  220. CHECK(angle == doctest::Approx(pi / (real_t)2));
  221. CHECK(axis == Vector3(1, 0, 0));
  222. Basis y90deg(0, 0, 1, 0, 1, 0, -1, 0, 0);
  223. y90deg.get_axis_angle(axis, angle);
  224. CHECK(axis == Vector3(0, 1, 0));
  225. Basis z90deg(0, -1, 0, 1, 0, 0, 0, 0, 1);
  226. z90deg.get_axis_angle(axis, angle);
  227. CHECK(axis == Vector3(0, 0, 1));
  228. // Regression test: checks that the method returns a small angle (not 0).
  229. Basis tiny(1, 0, 0, 0, 0.9999995, -0.001, 0, 001, 0.9999995); // The min angle possible with float is 0.001rad.
  230. tiny.get_axis_angle(axis, angle);
  231. CHECK(angle == doctest::Approx(0.001).epsilon(0.0001));
  232. // Regression test: checks that the method returns an angle which is a number (not NaN)
  233. Basis bugNan(1.00000024, 0, 0.000100001693, 0, 1, 0, -0.000100009143, 0, 1.00000024);
  234. bugNan.get_axis_angle(axis, angle);
  235. CHECK(!Math::is_nan(angle));
  236. }
  237. TEST_CASE("[Basis] Finite number checks") {
  238. const Vector3 x(0, 1, 2);
  239. const Vector3 infinite(NAN, NAN, NAN);
  240. CHECK_MESSAGE(
  241. Basis(x, x, x).is_finite(),
  242. "Basis with all components finite should be finite");
  243. CHECK_FALSE_MESSAGE(
  244. Basis(infinite, x, x).is_finite(),
  245. "Basis with one component infinite should not be finite.");
  246. CHECK_FALSE_MESSAGE(
  247. Basis(x, infinite, x).is_finite(),
  248. "Basis with one component infinite should not be finite.");
  249. CHECK_FALSE_MESSAGE(
  250. Basis(x, x, infinite).is_finite(),
  251. "Basis with one component infinite should not be finite.");
  252. CHECK_FALSE_MESSAGE(
  253. Basis(infinite, infinite, x).is_finite(),
  254. "Basis with two components infinite should not be finite.");
  255. CHECK_FALSE_MESSAGE(
  256. Basis(infinite, x, infinite).is_finite(),
  257. "Basis with two components infinite should not be finite.");
  258. CHECK_FALSE_MESSAGE(
  259. Basis(x, infinite, infinite).is_finite(),
  260. "Basis with two components infinite should not be finite.");
  261. CHECK_FALSE_MESSAGE(
  262. Basis(infinite, infinite, infinite).is_finite(),
  263. "Basis with three components infinite should not be finite.");
  264. }
  265. TEST_CASE("[Basis] Is conformal checks") {
  266. CHECK_MESSAGE(
  267. Basis().is_conformal(),
  268. "Identity Basis should be conformal.");
  269. CHECK_MESSAGE(
  270. Basis::from_euler(Vector3(1.2, 3.4, 5.6)).is_conformal(),
  271. "Basis with only rotation should be conformal.");
  272. CHECK_MESSAGE(
  273. Basis::from_scale(Vector3(-1, -1, -1)).is_conformal(),
  274. "Basis with only a flip should be conformal.");
  275. CHECK_MESSAGE(
  276. Basis::from_scale(Vector3(1.2, 1.2, 1.2)).is_conformal(),
  277. "Basis with only uniform scale should be conformal.");
  278. CHECK_MESSAGE(
  279. Basis(Vector3(3, 4, 0), Vector3(4, -3, 0.0), Vector3(0, 0, 5)).is_conformal(),
  280. "Basis with a flip, rotation, and uniform scale should be conformal.");
  281. CHECK_FALSE_MESSAGE(
  282. Basis::from_scale(Vector3(1.2, 3.4, 5.6)).is_conformal(),
  283. "Basis with non-uniform scale should not be conformal.");
  284. CHECK_FALSE_MESSAGE(
  285. Basis(Vector3(Math_SQRT12, Math_SQRT12, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)).is_conformal(),
  286. "Basis with the X axis skewed 45 degrees should not be conformal.");
  287. CHECK_MESSAGE(
  288. Basis(0, 0, 0, 0, 0, 0, 0, 0, 0).is_conformal(),
  289. "Edge case: Basis with all zeroes should return true for is_conformal (because a 0 scale is uniform).");
  290. }
  291. TEST_CASE("[Basis] Is orthogonal checks") {
  292. CHECK_MESSAGE(
  293. Basis().is_orthogonal(),
  294. "Identity Basis should be orthogonal.");
  295. CHECK_MESSAGE(
  296. Basis::from_euler(Vector3(1.2, 3.4, 5.6)).is_orthogonal(),
  297. "Basis with only rotation should be orthogonal.");
  298. CHECK_MESSAGE(
  299. Basis::from_scale(Vector3(-1, -1, -1)).is_orthogonal(),
  300. "Basis with only a flip should be orthogonal.");
  301. CHECK_MESSAGE(
  302. Basis::from_scale(Vector3(1.2, 3.4, 5.6)).is_orthogonal(),
  303. "Basis with only scale should be orthogonal.");
  304. CHECK_MESSAGE(
  305. Basis(Vector3(3, 4, 0), Vector3(4, -3, 0), Vector3(0, 0, 5)).is_orthogonal(),
  306. "Basis with a flip, rotation, and uniform scale should be orthogonal.");
  307. CHECK_FALSE_MESSAGE(
  308. Basis(Vector3(Math_SQRT12, Math_SQRT12, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)).is_orthogonal(),
  309. "Basis with the X axis skewed 45 degrees should not be orthogonal.");
  310. CHECK_MESSAGE(
  311. Basis(0, 0, 0, 0, 0, 0, 0, 0, 0).is_orthogonal(),
  312. "Edge case: Basis with all zeroes should return true for is_orthogonal, since zero vectors are orthogonal to all vectors.");
  313. }
  314. TEST_CASE("[Basis] Is orthonormal checks") {
  315. CHECK_MESSAGE(
  316. Basis().is_orthonormal(),
  317. "Identity Basis should be orthonormal.");
  318. CHECK_MESSAGE(
  319. Basis::from_euler(Vector3(1.2, 3.4, 5.6)).is_orthonormal(),
  320. "Basis with only rotation should be orthonormal.");
  321. CHECK_MESSAGE(
  322. Basis::from_scale(Vector3(-1, -1, -1)).is_orthonormal(),
  323. "Basis with only a flip should be orthonormal.");
  324. CHECK_FALSE_MESSAGE(
  325. Basis::from_scale(Vector3(1.2, 3.4, 5.6)).is_orthonormal(),
  326. "Basis with only scale should not be orthonormal.");
  327. CHECK_FALSE_MESSAGE(
  328. Basis(Vector3(3, 4, 0), Vector3(4, -3, 0), Vector3(0, 0, 5)).is_orthonormal(),
  329. "Basis with a flip, rotation, and uniform scale should not be orthonormal.");
  330. CHECK_FALSE_MESSAGE(
  331. Basis(Vector3(Math_SQRT12, Math_SQRT12, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)).is_orthonormal(),
  332. "Basis with the X axis skewed 45 degrees should not be orthonormal.");
  333. CHECK_FALSE_MESSAGE(
  334. Basis(0, 0, 0, 0, 0, 0, 0, 0, 0).is_orthonormal(),
  335. "Edge case: Basis with all zeroes should return false for is_orthonormal, since the vectors do not have a length of 1.");
  336. }
  337. TEST_CASE("[Basis] Is rotation checks") {
  338. CHECK_MESSAGE(
  339. Basis().is_rotation(),
  340. "Identity Basis should be a rotation (a rotation of zero).");
  341. CHECK_MESSAGE(
  342. Basis::from_euler(Vector3(1.2, 3.4, 5.6)).is_rotation(),
  343. "Basis with only rotation should be a rotation.");
  344. CHECK_FALSE_MESSAGE(
  345. Basis::from_scale(Vector3(-1, -1, -1)).is_rotation(),
  346. "Basis with only a flip should not be a rotation.");
  347. CHECK_FALSE_MESSAGE(
  348. Basis::from_scale(Vector3(1.2, 3.4, 5.6)).is_rotation(),
  349. "Basis with only scale should not be a rotation.");
  350. CHECK_FALSE_MESSAGE(
  351. Basis(Vector3(2, 0, 0), Vector3(0, 0.5, 0), Vector3(0, 0, 1)).is_rotation(),
  352. "Basis with a squeeze should not be a rotation.");
  353. CHECK_FALSE_MESSAGE(
  354. Basis(Vector3(Math_SQRT12, Math_SQRT12, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)).is_rotation(),
  355. "Basis with the X axis skewed 45 degrees should not be a rotation.");
  356. CHECK_FALSE_MESSAGE(
  357. Basis(0, 0, 0, 0, 0, 0, 0, 0, 0).is_rotation(),
  358. "Edge case: Basis with all zeroes should return false for is_rotation, because it is not just a rotation (has a scale of 0).");
  359. }
  360. } // namespace TestBasis
  361. #endif // TEST_BASIS_H