SpiecsEngine
 
Loading...
Searching...
No Matches

◆ TEST() [28/59]

SpicesTest::TEST ( Math_test ,
DecomposeTransform  )

Testing DecomposeTransform.

Definition at line 71 of file Math_test.h.

71 {
72
74
75 {
76 glm::mat4 matrix = {
77 -1, 0, 0, 0,
78 0, 1, 0, 0,
79 0, 0, -1, 0,
80 0, 0, 0, 1
81 };
82 glm::vec3 position;
83 glm::vec3 rotation;
84 glm::vec3 scale;
85
86 Spices::DecomposeTransform(matrix, position, rotation, scale);
87
88 rotation = glm::vec3(glm::degrees(rotation.x), glm::degrees(rotation.y), glm::degrees(rotation.z));
89 }
90
91 {
92 glm::mat4 matrix = {
93 1, 0, 0, 0,
94 0, 1, 0, 0,
95 0, 0, 1, 0,
96 0, 0, 0, 1
97 };
98 glm::vec3 position;
99 glm::vec3 rotation;
100 glm::vec3 scale;
101
102 Spices::DecomposeTransform(matrix, position, rotation, scale);
103
104 rotation = glm::vec3(glm::degrees(rotation.x), glm::degrees(rotation.y), glm::degrees(rotation.z));
105 }
106
107 {
108 glm::quat rotationQuat = glm::quat(0.5, -0.5, -0.5, -0.5);
109 glm::mat4 matrix = glm::toMat4(rotationQuat);
110
111 glm::vec3 position;
112 glm::vec3 rotation;
113 glm::vec3 scale;
114
115 Spices::DecomposeTransform(matrix, position, rotation, scale);
116
117 rotation = glm::vec3(glm::degrees(rotation.x), glm::degrees(rotation.y), glm::degrees(rotation.z));
118 }
119
120 {
121 glm::quat rotationQuat({ -0.7898206, 0.613338, 0, 0 });
122 glm::mat4 matrix = glm::toMat4(rotationQuat);
123
124 glm::vec3 position;
125 glm::vec3 rotation;
126 glm::vec3 scale;
127
128 Spices::DecomposeTransform(matrix, position, rotation, scale);
129
130 rotation = glm::vec3(glm::degrees(rotation.x), glm::degrees(rotation.y), glm::degrees(rotation.z));
131 }
132 }
#define SPICESTEST_PROFILE_FUNCTION()
bool DecomposeTransform(const glm::mat4 &transform, glm::vec3 &outTranslation, glm::vec3 &outRotation, glm::vec3 &outScale)
Decompose matrix to split SRT transform.
Definition Math.cpp:15