|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
#include "../Tests.h"
|
|
#include "../Tests.h"
|
|
#include "core/Generic.h"
|
|
#include "core/Generic.h"
|
|
|
|
+#include "core/Utility.h"
|
|
|
|
|
|
static const float eps = 0.0001f;
|
|
static const float eps = 0.0001f;
|
|
|
|
|
|
@@ -35,38 +36,46 @@ static const float eps = 0.0001f;
|
|
|
|
|
|
#define TESTS X(V2) X(V3) X(V4) X(IV2) X(IV3) X(IV4)
|
|
#define TESTS X(V2) X(V3) X(V4) X(IV2) X(IV3) X(IV4)
|
|
|
|
|
|
|
|
+#define R45 degreeToRadian(45.0f)
|
|
|
|
+#define R90 degreeToRadian(90.0f)
|
|
|
|
+#define R135 degreeToRadian(135.0f)
|
|
|
|
+#define R180 degreeToRadian(180.0f)
|
|
|
|
+#define R225 degreeToRadian(225.0f)
|
|
|
|
+#define R270 degreeToRadian(270.0f)
|
|
|
|
+#define R315 degreeToRadian(315.0f)
|
|
|
|
+
|
|
static void testSetAngles() {
|
|
static void testSetAngles() {
|
|
float root = sqrtf(2) * 0.5f;
|
|
float root = sqrtf(2) * 0.5f;
|
|
TEST_V3(FV3(1, 0, 0), angles(CV30, 0, 0));
|
|
TEST_V3(FV3(1, 0, 0), angles(CV30, 0, 0));
|
|
- TEST_V3(FV3(root, 0, -root), angles(CV30, 45, 0));
|
|
|
|
- TEST_V3(FV3(0, 0, -1), angles(CV30, 90, 0));
|
|
|
|
- TEST_V3(FV3(-root, 0, -root), angles(CV30, 135, 0));
|
|
|
|
- TEST_V3(FV3(-1, 0, 0), angles(CV30, 180, 0));
|
|
|
|
- TEST_V3(FV3(-root, 0, root), angles(CV30, 225, 0));
|
|
|
|
- TEST_V3(FV3(0, 0, 1), angles(CV30, 270, 0));
|
|
|
|
- TEST_V3(FV3(root, 0, root), angles(CV30, 315, 0));
|
|
|
|
-
|
|
|
|
- TEST_V3(FV3(0, 1, 0), angles(CV30, 0, 90));
|
|
|
|
- TEST_V3(FV3(0, 1, 0), angles(CV30, 90, 90));
|
|
|
|
- TEST_V3(FV3(0, 1, 0), angles(CV30, 180, 90));
|
|
|
|
- TEST_V3(FV3(0, 1, 0), angles(CV30, 270, 90));
|
|
|
|
-
|
|
|
|
- TEST_V3(FV3(0, -1, 0), angles(CV30, 0, -90));
|
|
|
|
- TEST_V3(FV3(0, -1, 0), angles(CV30, 90, -90));
|
|
|
|
- TEST_V3(FV3(0, -1, 0), angles(CV30, 180, -90));
|
|
|
|
- TEST_V3(FV3(0, -1, 0), angles(CV30, 270, -90));
|
|
|
|
-
|
|
|
|
- TEST_V3(FV3(root, root, 0), angles(CV30, 0, 45));
|
|
|
|
- TEST_V3(FV3(0, root, -root), angles(CV30, 90, 45));
|
|
|
|
- TEST_V3(FV3(-root, root, 0), angles(CV30, 180, 45));
|
|
|
|
- TEST_V3(FV3(0, root, root), angles(CV30, 270, 45));
|
|
|
|
-
|
|
|
|
- TEST_V3(FV3(root, -root, 0), angles(CV30, 0, -45));
|
|
|
|
- TEST_V3(FV3(0, -root, -root), angles(CV30, 90, -45));
|
|
|
|
- TEST_V3(FV3(-root, -root, 0), angles(CV30, 180, -45));
|
|
|
|
- TEST_V3(FV3(0, -root, root), angles(CV30, 270, -45));
|
|
|
|
-
|
|
|
|
- TEST_V3(FV3(0.5f, root, -0.5f), angles(CV30, 45, 45));
|
|
|
|
|
|
+ TEST_V3(FV3(root, 0, -root), angles(CV30, R45, 0));
|
|
|
|
+ TEST_V3(FV3(0, 0, -1), angles(CV30, R90, 0));
|
|
|
|
+ TEST_V3(FV3(-root, 0, -root), angles(CV30, R135, 0));
|
|
|
|
+ TEST_V3(FV3(-1, 0, 0), angles(CV30, R180, 0));
|
|
|
|
+ TEST_V3(FV3(-root, 0, root), angles(CV30, R225, 0));
|
|
|
|
+ TEST_V3(FV3(0, 0, 1), angles(CV30, R270, 0));
|
|
|
|
+ TEST_V3(FV3(root, 0, root), angles(CV30, R315, 0));
|
|
|
|
+
|
|
|
|
+ TEST_V3(FV3(0, 1, 0), angles(CV30, 0, R90));
|
|
|
|
+ TEST_V3(FV3(0, 1, 0), angles(CV30, R90, R90));
|
|
|
|
+ TEST_V3(FV3(0, 1, 0), angles(CV30, R180, R90));
|
|
|
|
+ TEST_V3(FV3(0, 1, 0), angles(CV30, R270, R90));
|
|
|
|
+
|
|
|
|
+ TEST_V3(FV3(0, -1, 0), angles(CV30, 0, -R90));
|
|
|
|
+ TEST_V3(FV3(0, -1, 0), angles(CV30, R90, -R90));
|
|
|
|
+ TEST_V3(FV3(0, -1, 0), angles(CV30, R180, -R90));
|
|
|
|
+ TEST_V3(FV3(0, -1, 0), angles(CV30, R270, -R90));
|
|
|
|
+
|
|
|
|
+ TEST_V3(FV3(root, root, 0), angles(CV30, 0, R45));
|
|
|
|
+ TEST_V3(FV3(0, root, -root), angles(CV30, R90, R45));
|
|
|
|
+ TEST_V3(FV3(-root, root, 0), angles(CV30, R180, R45));
|
|
|
|
+ TEST_V3(FV3(0, root, root), angles(CV30, R270, R45));
|
|
|
|
+
|
|
|
|
+ TEST_V3(FV3(root, -root, 0), angles(CV30, 0, -R45));
|
|
|
|
+ TEST_V3(FV3(0, -root, -root), angles(CV30, R90, -R45));
|
|
|
|
+ TEST_V3(FV3(-root, -root, 0), angles(CV30, R180, -R45));
|
|
|
|
+ TEST_V3(FV3(0, -root, root), angles(CV30, R270, -R45));
|
|
|
|
+
|
|
|
|
+ TEST_V3(FV3(0.5f, root, -0.5f), angles(CV30, R45, R45));
|
|
}
|
|
}
|
|
|
|
|
|
static void testCross() {
|
|
static void testCross() {
|