mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 01:00:46 +00:00
improve matrix to quaternion
This commit is contained in:
@@ -55,12 +55,8 @@ test_rand_angle(void) {
|
||||
void
|
||||
test_rand_quat(versor q) {
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
q[0] = drand48();
|
||||
q[1] = drand48();
|
||||
q[2] = drand48();
|
||||
q[3] = drand48();
|
||||
|
||||
glm_quat(q, drand48(), drand48(), drand48(), drand48());
|
||||
glm_quat_normalize(q);
|
||||
}
|
||||
|
||||
|
@@ -9,14 +9,16 @@
|
||||
|
||||
void
|
||||
test_quat(void **state) {
|
||||
mat4 rot;
|
||||
mat4 inRot, outRot;
|
||||
versor inQuat, outQuat;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 10000; i++) {
|
||||
for (i = 0; i < 1000; i++) {
|
||||
test_rand_quat(inQuat);
|
||||
glmc_quat_mat4(inQuat, rot);
|
||||
glm_mat4_quat(rot, outQuat);
|
||||
glmc_quat_mat4(inQuat, inRot);
|
||||
glmc_mat4_quat(inRot, outQuat);
|
||||
glmc_quat_mat4(outQuat, outRot);
|
||||
test_assert_quat_eq(inQuat, outQuat);
|
||||
test_assert_mat4_eq2(inRot, outRot, 0.000009); /* almost equal */
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user