mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 02:06:15 +02:00
Simplify isEqual computation for vectors used in Rig
This commit is contained in:
parent
569bef50fd
commit
d8644a2745
1 changed files with 6 additions and 12 deletions
|
@ -39,14 +39,13 @@ static int nextRigId = 1;
|
|||
static std::map<int, Rig*> rigRegistry;
|
||||
static std::mutex rigRegistryMutex;
|
||||
|
||||
static bool isEqual(const float p, float q) {
|
||||
const float EPSILON = 0.00001f;
|
||||
return fabsf(p - q) <= EPSILON;
|
||||
}
|
||||
|
||||
static bool isEqual(const glm::vec3& u, const glm::vec3& v) {
|
||||
const float EPSILON = 0.0001f;
|
||||
float uLen = glm::length(u);
|
||||
if (uLen == 0.0f) {
|
||||
return glm::length(v) <= EPSILON;
|
||||
} else {
|
||||
return (glm::length(u - v) / uLen) <= EPSILON;
|
||||
}
|
||||
return isEqual(u.x, v.x) && isEqual(u.y, v.y) && isEqual(u.z, v.z);
|
||||
}
|
||||
|
||||
static bool isEqual(const glm::quat& p, const glm::quat& q) {
|
||||
|
@ -54,11 +53,6 @@ static bool isEqual(const glm::quat& p, const glm::quat& q) {
|
|||
return 1.0f - fabsf(glm::dot(p, q)) <= EPSILON;
|
||||
}
|
||||
|
||||
static bool isEqual(const float p, float q) {
|
||||
const float EPSILON = 0.00001f;
|
||||
return fabsf(p - q) <= EPSILON;
|
||||
}
|
||||
|
||||
#define ASSERT(cond) assert(cond)
|
||||
|
||||
// 2 meter tall dude
|
||||
|
|
Loading…
Reference in a new issue