Skip to content

Commit 5070a42

Browse files
authored
Merge pull request #1083 from Logan-ReXDev/4.4-cherry-pick/fix-quaternion
[4.4] Fix Quaternion arc constructor tolerance
2 parents 0e14871 + 4240402 commit 5070a42

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/math/quaternion.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,11 @@ struct [[nodiscard]] Quaternion {
146146
#ifdef MATH_CHECKS
147147
ERR_FAIL_COND_MSG(p_v0.is_zero_approx() || p_v1.is_zero_approx(), "The vectors must not be zero.");
148148
#endif
149-
constexpr real_t ALMOST_ONE = 1.0f - (real_t)CMP_EPSILON;
149+
#ifdef REAL_T_IS_DOUBLE
150+
constexpr real_t ALMOST_ONE = 0.999999999999999;
151+
#else
152+
constexpr real_t ALMOST_ONE = 0.99999975f;
153+
#endif
150154
Vector3 n0 = p_v0.normalized();
151155
Vector3 n1 = p_v1.normalized();
152156
real_t d = n0.dot(n1);
@@ -169,6 +173,7 @@ struct [[nodiscard]] Quaternion {
169173
z = c.z * rs;
170174
w = s * 0.5f;
171175
}
176+
normalize();
172177
}
173178
};
174179

0 commit comments

Comments
 (0)