test_basis.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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. #pragma once
  31. #include "core/math/basis.h"
  32. #include "core/math/random_number_generator.h"
  33. #include "tests/test_macros.h"
  34. namespace TestBasis {
  35. Vector3 deg_to_rad(const Vector3 &p_rotation) {
  36. return p_rotation / 180.0 * Math::PI;
  37. }
  38. Vector3 rad2deg(const Vector3 &p_rotation) {
  39. return p_rotation / Math::PI * 180.0;
  40. }
  41. String get_rot_order_name(EulerOrder ro) {
  42. switch (ro) {
  43. case EulerOrder::XYZ:
  44. return "XYZ";
  45. case EulerOrder::XZY:
  46. return "XZY";
  47. case EulerOrder::YZX:
  48. return "YZX";
  49. case EulerOrder::YXZ:
  50. return "YXZ";
  51. case EulerOrder::ZXY:
  52. return "ZXY";
  53. case EulerOrder::ZYX:
  54. return "ZYX";
  55. default:
  56. return "[Not supported]";
  57. }
  58. }
  59. void test_rotation(Vector3 deg_original_euler, EulerOrder rot_order) {
  60. // This test:
  61. // 1. Converts the rotation vector from deg to rad.
  62. // 2. Converts euler to basis.
  63. // 3. Converts the above basis back into euler.
  64. // 4. Converts the above euler into basis again.
  65. // 5. Compares the basis obtained in step 2 with the basis of step 4
  66. //
  67. // The conversion "basis to euler", done in the step 3, may be different from
  68. // the original euler, even if the final rotation are the same.
  69. // This happens because there are more ways to represents the same rotation,
  70. // both valid, using eulers.
  71. // For this reason is necessary to convert that euler back to basis and finally
  72. // compares it.
  73. //
  74. // In this way we can assert that both functions: basis to euler / euler to basis
  75. // are correct.
  76. // Euler to rotation
  77. const Vector3 original_euler = deg_to_rad(deg_original_euler);
  78. const Basis to_rotation = Basis::from_euler(original_euler, rot_order);
  79. // Euler from rotation
  80. const Vector3 euler_from_rotation = to_rotation.get_euler(rot_order);
  81. const Basis rotation_from_computed_euler = Basis::from_euler(euler_from_rotation, rot_order);
  82. Basis res = to_rotation.inverse() * rotation_from_computed_euler;
  83. 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))));
  84. 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))));
  85. 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))));
  86. // Double check `to_rotation` decomposing with XYZ rotation order.
  87. const Vector3 euler_xyz_from_rotation = to_rotation.get_euler(EulerOrder::XYZ);
  88. Basis rotation_from_xyz_computed_euler = Basis::from_euler(euler_xyz_from_rotation, EulerOrder::XYZ);
  89. res = to_rotation.inverse() * rotation_from_xyz_computed_euler;
  90. 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))));
  91. 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))));
  92. 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))));
  93. INFO(vformat("Rotation order: %s\n.", get_rot_order_name(rot_order)));
  94. INFO(vformat("Original Rotation: %s\n", String(deg_original_euler)));
  95. INFO(vformat("Quaternion to rotation order: %s\n", String(rad2deg(euler_from_rotation))));
  96. }
  97. TEST_CASE("[Basis] Euler conversions") {
  98. Vector<EulerOrder> euler_order_to_test;
  99. euler_order_to_test.push_back(EulerOrder::XYZ);
  100. euler_order_to_test.push_back(EulerOrder::XZY);
  101. euler_order_to_test.push_back(EulerOrder::YZX);
  102. euler_order_to_test.push_back(EulerOrder::YXZ);
  103. euler_order_to_test.push_back(EulerOrder::ZXY);
  104. euler_order_to_test.push_back(EulerOrder::ZYX);
  105. Vector<Vector3> vectors_to_test;
  106. // Test the special cases.
  107. vectors_to_test.push_back(Vector3(0.0, 0.0, 0.0));
  108. vectors_to_test.push_back(Vector3(0.5, 0.5, 0.5));
  109. vectors_to_test.push_back(Vector3(-0.5, -0.5, -0.5));
  110. vectors_to_test.push_back(Vector3(40.0, 40.0, 40.0));
  111. vectors_to_test.push_back(Vector3(-40.0, -40.0, -40.0));
  112. vectors_to_test.push_back(Vector3(0.0, 0.0, -90.0));
  113. vectors_to_test.push_back(Vector3(0.0, -90.0, 0.0));
  114. vectors_to_test.push_back(Vector3(-90.0, 0.0, 0.0));
  115. vectors_to_test.push_back(Vector3(0.0, 0.0, 90.0));
  116. vectors_to_test.push_back(Vector3(0.0, 90.0, 0.0));
  117. vectors_to_test.push_back(Vector3(90.0, 0.0, 0.0));
  118. vectors_to_test.push_back(Vector3(0.0, 0.0, -30.0));
  119. vectors_to_test.push_back(Vector3(0.0, -30.0, 0.0));
  120. vectors_to_test.push_back(Vector3(-30.0, 0.0, 0.0));
  121. vectors_to_test.push_back(Vector3(0.0, 0.0, 30.0));
  122. vectors_to_test.push_back(Vector3(0.0, 30.0, 0.0));
  123. vectors_to_test.push_back(Vector3(30.0, 0.0, 0.0));
  124. vectors_to_test.push_back(Vector3(0.5, 50.0, 20.0));
  125. vectors_to_test.push_back(Vector3(-0.5, -50.0, -20.0));
  126. vectors_to_test.push_back(Vector3(0.5, 0.0, 90.0));
  127. vectors_to_test.push_back(Vector3(0.5, 0.0, -90.0));
  128. vectors_to_test.push_back(Vector3(360.0, 360.0, 360.0));
  129. vectors_to_test.push_back(Vector3(-360.0, -360.0, -360.0));
  130. vectors_to_test.push_back(Vector3(-90.0, 60.0, -90.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(60.0, 90.0, -40.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(-90.0, 90.0, -90.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(20.0, 150.0, 30.0));
  153. vectors_to_test.push_back(Vector3(20.0, -150.0, 30.0));
  154. vectors_to_test.push_back(Vector3(-120.0, -150.0, 30.0));
  155. vectors_to_test.push_back(Vector3(-120.0, -150.0, -130.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(89.9, 0.0, 0.0));
  160. vectors_to_test.push_back(Vector3(-89.9, 0.0, 0.0));
  161. vectors_to_test.push_back(Vector3(0.0, 89.9, 0.0));
  162. vectors_to_test.push_back(Vector3(0.0, -89.9, 0.0));
  163. vectors_to_test.push_back(Vector3(0.0, 0.0, 89.9));
  164. vectors_to_test.push_back(Vector3(0.0, 0.0, -89.9));
  165. for (int h = 0; h < euler_order_to_test.size(); h += 1) {
  166. for (int i = 0; i < vectors_to_test.size(); i += 1) {
  167. test_rotation(vectors_to_test[i], euler_order_to_test[h]);
  168. }
  169. }
  170. }
  171. TEST_CASE("[Stress][Basis] Euler conversions") {
  172. Vector<EulerOrder> euler_order_to_test;
  173. euler_order_to_test.push_back(EulerOrder::XYZ);
  174. euler_order_to_test.push_back(EulerOrder::XZY);
  175. euler_order_to_test.push_back(EulerOrder::YZX);
  176. euler_order_to_test.push_back(EulerOrder::YXZ);
  177. euler_order_to_test.push_back(EulerOrder::ZXY);
  178. euler_order_to_test.push_back(EulerOrder::ZYX);
  179. Vector<Vector3> vectors_to_test;
  180. // Add 1000 random vectors with weirds numbers.
  181. RandomNumberGenerator rng;
  182. for (int _ = 0; _ < 1000; _ += 1) {
  183. vectors_to_test.push_back(Vector3(
  184. rng.randf_range(-1800, 1800),
  185. rng.randf_range(-1800, 1800),
  186. rng.randf_range(-1800, 1800)));
  187. }
  188. for (int h = 0; h < euler_order_to_test.size(); h += 1) {
  189. for (int i = 0; i < vectors_to_test.size(); i += 1) {
  190. test_rotation(vectors_to_test[i], euler_order_to_test[h]);
  191. }
  192. }
  193. }
  194. TEST_CASE("[Basis] Set axis angle") {
  195. Vector3 axis;
  196. real_t angle;
  197. real_t pi = (real_t)Math::PI;
  198. // Testing the singularity when the angle is 0°.
  199. Basis identity(1, 0, 0, 0, 1, 0, 0, 0, 1);
  200. identity.get_axis_angle(axis, angle);
  201. CHECK(angle == 0);
  202. // Testing the singularity when the angle is 180°.
  203. Basis singularityPi(-1, 0, 0, 0, 1, 0, 0, 0, -1);
  204. singularityPi.get_axis_angle(axis, angle);
  205. CHECK(angle == doctest::Approx(pi));
  206. // Testing reversing the an axis (of an 30° angle).
  207. float cos30deg = Math::cos(Math::deg_to_rad((real_t)30.0));
  208. Basis z_positive(cos30deg, -0.5, 0, 0.5, cos30deg, 0, 0, 0, 1);
  209. Basis z_negative(cos30deg, 0.5, 0, -0.5, cos30deg, 0, 0, 0, 1);
  210. z_positive.get_axis_angle(axis, angle);
  211. CHECK(angle == doctest::Approx(Math::deg_to_rad((real_t)30.0)));
  212. CHECK(axis == Vector3(0, 0, 1));
  213. z_negative.get_axis_angle(axis, angle);
  214. CHECK(angle == doctest::Approx(Math::deg_to_rad((real_t)30.0)));
  215. CHECK(axis == Vector3(0, 0, -1));
  216. // Testing a rotation of 90° on x-y-z.
  217. Basis x90deg(1, 0, 0, 0, 0, -1, 0, 1, 0);
  218. x90deg.get_axis_angle(axis, angle);
  219. CHECK(angle == doctest::Approx(pi / (real_t)2));
  220. CHECK(axis == Vector3(1, 0, 0));
  221. Basis y90deg(0, 0, 1, 0, 1, 0, -1, 0, 0);
  222. y90deg.get_axis_angle(axis, angle);
  223. CHECK(axis == Vector3(0, 1, 0));
  224. Basis z90deg(0, -1, 0, 1, 0, 0, 0, 0, 1);
  225. z90deg.get_axis_angle(axis, angle);
  226. CHECK(axis == Vector3(0, 0, 1));
  227. // Regression test: checks that the method returns a small angle (not 0).
  228. Basis tiny(1, 0, 0, 0, 0.9999995, -0.001, 0, 001, 0.9999995); // The min angle possible with float is 0.001rad.
  229. tiny.get_axis_angle(axis, angle);
  230. CHECK(angle == doctest::Approx(0.001).epsilon(0.0001));
  231. // Regression test: checks that the method returns an angle which is a number (not NaN)
  232. Basis bugNan(1.00000024, 0, 0.000100001693, 0, 1, 0, -0.000100009143, 0, 1.00000024);
  233. bugNan.get_axis_angle(axis, angle);
  234. CHECK(!Math::is_nan(angle));
  235. }
  236. TEST_CASE("[Basis] Finite number checks") {
  237. constexpr Vector3 x(0, 1, 2);
  238. constexpr Vector3 infinite(Math::NaN, Math::NaN, Math::NaN);
  239. CHECK_MESSAGE(
  240. Basis(x, x, x).is_finite(),
  241. "Basis with all components finite should be finite");
  242. CHECK_FALSE_MESSAGE(
  243. Basis(infinite, x, x).is_finite(),
  244. "Basis with one component infinite should not be finite.");
  245. CHECK_FALSE_MESSAGE(
  246. Basis(x, infinite, x).is_finite(),
  247. "Basis with one component infinite should not be finite.");
  248. CHECK_FALSE_MESSAGE(
  249. Basis(x, x, infinite).is_finite(),
  250. "Basis with one component infinite should not be finite.");
  251. CHECK_FALSE_MESSAGE(
  252. Basis(infinite, infinite, x).is_finite(),
  253. "Basis with two components infinite should not be finite.");
  254. CHECK_FALSE_MESSAGE(
  255. Basis(infinite, x, infinite).is_finite(),
  256. "Basis with two components infinite should not be finite.");
  257. CHECK_FALSE_MESSAGE(
  258. Basis(x, infinite, infinite).is_finite(),
  259. "Basis with two components infinite should not be finite.");
  260. CHECK_FALSE_MESSAGE(
  261. Basis(infinite, infinite, infinite).is_finite(),
  262. "Basis with three components infinite should not be finite.");
  263. }
  264. TEST_CASE("[Basis] Is conformal checks") {
  265. CHECK_MESSAGE(
  266. Basis().is_conformal(),
  267. "Identity Basis should be conformal.");
  268. CHECK_MESSAGE(
  269. Basis::from_euler(Vector3(1.2, 3.4, 5.6)).is_conformal(),
  270. "Basis with only rotation should be conformal.");
  271. CHECK_MESSAGE(
  272. Basis::from_scale(Vector3(-1, -1, -1)).is_conformal(),
  273. "Basis with only a flip should be conformal.");
  274. CHECK_MESSAGE(
  275. Basis::from_scale(Vector3(1.2, 1.2, 1.2)).is_conformal(),
  276. "Basis with only uniform scale should be conformal.");
  277. CHECK_MESSAGE(
  278. Basis(Vector3(3, 4, 0), Vector3(4, -3, 0.0), Vector3(0, 0, 5)).is_conformal(),
  279. "Basis with a flip, rotation, and uniform scale should be conformal.");
  280. CHECK_FALSE_MESSAGE(
  281. Basis::from_scale(Vector3(1.2, 3.4, 5.6)).is_conformal(),
  282. "Basis with non-uniform scale should not be conformal.");
  283. CHECK_FALSE_MESSAGE(
  284. Basis(Vector3(Math::SQRT12, Math::SQRT12, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)).is_conformal(),
  285. "Basis with the X axis skewed 45 degrees should not be conformal.");
  286. CHECK_MESSAGE(
  287. Basis(0, 0, 0, 0, 0, 0, 0, 0, 0).is_conformal(),
  288. "Edge case: Basis with all zeroes should return true for is_conformal (because a 0 scale is uniform).");
  289. }
  290. TEST_CASE("[Basis] Is orthogonal checks") {
  291. CHECK_MESSAGE(
  292. Basis().is_orthogonal(),
  293. "Identity Basis should be orthogonal.");
  294. CHECK_MESSAGE(
  295. Basis::from_euler(Vector3(1.2, 3.4, 5.6)).is_orthogonal(),
  296. "Basis with only rotation should be orthogonal.");
  297. CHECK_MESSAGE(
  298. Basis::from_scale(Vector3(-1, -1, -1)).is_orthogonal(),
  299. "Basis with only a flip should be orthogonal.");
  300. CHECK_MESSAGE(
  301. Basis::from_scale(Vector3(1.2, 3.4, 5.6)).is_orthogonal(),
  302. "Basis with only scale should be orthogonal.");
  303. CHECK_MESSAGE(
  304. Basis(Vector3(3, 4, 0), Vector3(4, -3, 0), Vector3(0, 0, 5)).is_orthogonal(),
  305. "Basis with a flip, rotation, and uniform scale should be orthogonal.");
  306. CHECK_FALSE_MESSAGE(
  307. Basis(Vector3(Math::SQRT12, Math::SQRT12, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)).is_orthogonal(),
  308. "Basis with the X axis skewed 45 degrees should not be orthogonal.");
  309. CHECK_MESSAGE(
  310. Basis(0, 0, 0, 0, 0, 0, 0, 0, 0).is_orthogonal(),
  311. "Edge case: Basis with all zeroes should return true for is_orthogonal, since zero vectors are orthogonal to all vectors.");
  312. }
  313. TEST_CASE("[Basis] Is orthonormal checks") {
  314. CHECK_MESSAGE(
  315. Basis().is_orthonormal(),
  316. "Identity Basis should be orthonormal.");
  317. CHECK_MESSAGE(
  318. Basis::from_euler(Vector3(1.2, 3.4, 5.6)).is_orthonormal(),
  319. "Basis with only rotation should be orthonormal.");
  320. CHECK_MESSAGE(
  321. Basis::from_scale(Vector3(-1, -1, -1)).is_orthonormal(),
  322. "Basis with only a flip should be orthonormal.");
  323. CHECK_FALSE_MESSAGE(
  324. Basis::from_scale(Vector3(1.2, 3.4, 5.6)).is_orthonormal(),
  325. "Basis with only scale should not be orthonormal.");
  326. CHECK_FALSE_MESSAGE(
  327. Basis(Vector3(3, 4, 0), Vector3(4, -3, 0), Vector3(0, 0, 5)).is_orthonormal(),
  328. "Basis with a flip, rotation, and uniform scale should not be orthonormal.");
  329. CHECK_FALSE_MESSAGE(
  330. Basis(Vector3(Math::SQRT12, Math::SQRT12, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)).is_orthonormal(),
  331. "Basis with the X axis skewed 45 degrees should not be orthonormal.");
  332. CHECK_FALSE_MESSAGE(
  333. Basis(0, 0, 0, 0, 0, 0, 0, 0, 0).is_orthonormal(),
  334. "Edge case: Basis with all zeroes should return false for is_orthonormal, since the vectors do not have a length of 1.");
  335. }
  336. TEST_CASE("[Basis] Is rotation checks") {
  337. CHECK_MESSAGE(
  338. Basis().is_rotation(),
  339. "Identity Basis should be a rotation (a rotation of zero).");
  340. CHECK_MESSAGE(
  341. Basis::from_euler(Vector3(1.2, 3.4, 5.6)).is_rotation(),
  342. "Basis with only rotation should be a rotation.");
  343. CHECK_FALSE_MESSAGE(
  344. Basis::from_scale(Vector3(-1, -1, -1)).is_rotation(),
  345. "Basis with only a flip should not be a rotation.");
  346. CHECK_FALSE_MESSAGE(
  347. Basis::from_scale(Vector3(1.2, 3.4, 5.6)).is_rotation(),
  348. "Basis with only scale should not be a rotation.");
  349. CHECK_FALSE_MESSAGE(
  350. Basis(Vector3(2, 0, 0), Vector3(0, 0.5, 0), Vector3(0, 0, 1)).is_rotation(),
  351. "Basis with a squeeze should not be a rotation.");
  352. CHECK_FALSE_MESSAGE(
  353. Basis(Vector3(Math::SQRT12, Math::SQRT12, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)).is_rotation(),
  354. "Basis with the X axis skewed 45 degrees should not be a rotation.");
  355. CHECK_FALSE_MESSAGE(
  356. Basis(0, 0, 0, 0, 0, 0, 0, 0, 0).is_rotation(),
  357. "Edge case: Basis with all zeroes should return false for is_rotation, because it is not just a rotation (has a scale of 0).");
  358. }
  359. } // namespace TestBasis