|
|
@ -36,7 +36,8 @@ int test_dquat_type() |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int test_scalars() { |
|
|
|
int test_scalars() |
|
|
|
|
|
|
|
{ |
|
|
|
float const Epsilon = 0.0001f; |
|
|
|
float const Epsilon = 0.0001f; |
|
|
|
|
|
|
|
|
|
|
|
int Error(0); |
|
|
|
int Error(0); |
|
|
@ -115,7 +116,8 @@ int test_mul() |
|
|
|
|
|
|
|
|
|
|
|
glm::mat4x4 mid(1.0f); |
|
|
|
glm::mat4x4 mid(1.0f); |
|
|
|
|
|
|
|
|
|
|
|
for (int j = 0; j < 100; ++j) { |
|
|
|
for (int j = 0; j < 100; ++j) |
|
|
|
|
|
|
|
{ |
|
|
|
// generate random rotations and translations and compare transformed by matrix and dualquats random points
|
|
|
|
// generate random rotations and translations and compare transformed by matrix and dualquats random points
|
|
|
|
glm::vec3 vt1 = glm::vec3(myfrand() * 10.0f, myfrand() * 10.0f, myfrand() * 10.0f); |
|
|
|
glm::vec3 vt1 = glm::vec3(myfrand() * 10.0f, myfrand() * 10.0f, myfrand() * 10.0f); |
|
|
|
glm::vec3 vt2 = glm::vec3(myfrand() * 10.0f, myfrand() * 10.0f, myfrand() * 10.0f); |
|
|
|
glm::vec3 vt2 = glm::vec3(myfrand() * 10.0f, myfrand() * 10.0f, myfrand() * 10.0f); |
|
|
@ -135,7 +137,8 @@ int test_mul() |
|
|
|
glm::dualquat dq3 = dq2 * dq1; |
|
|
|
glm::dualquat dq3 = dq2 * dq1; |
|
|
|
glm::dualquat dq4 = dq1 * dq2; |
|
|
|
glm::dualquat dq4 = dq1 * dq2; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 100; ++i) { |
|
|
|
for (int i = 0; i < 100; ++i) |
|
|
|
|
|
|
|
{ |
|
|
|
glm::vec4 src_pt = glm::vec4(myfrand() * 4.0f, myfrand() * 5.0f, myfrand() * 3.0f,1.0f); |
|
|
|
glm::vec4 src_pt = glm::vec4(myfrand() * 4.0f, myfrand() * 5.0f, myfrand() * 3.0f,1.0f); |
|
|
|
// test both multiplication orders
|
|
|
|
// test both multiplication orders
|
|
|
|
glm::vec4 dst_pt_m3 = m3 * src_pt;
|
|
|
|
glm::vec4 dst_pt_m3 = m3 * src_pt;
|
|
|
@ -191,6 +194,5 @@ int main() |
|
|
|
Error += test_inverse(); |
|
|
|
Error += test_inverse(); |
|
|
|
Error += test_mul(); |
|
|
|
Error += test_mul(); |
|
|
|
|
|
|
|
|
|
|
|
//std::cout << "Errors count: " << Error << std::endl;
|
|
|
|
|
|
|
|
return Error; |
|
|
|
return Error; |
|
|
|
} |
|
|
|
} |
|
|
|