Skip to content

Commit 6c2d288

Browse files
committed
Merge pull request #106337 from TokageItLab/arc-tolerance
Fix Quaternion arc constructor tolerance
2 parents 7258540 + 37aca09 commit 6c2d288

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
@@ -139,7 +139,11 @@ struct [[nodiscard]] Quaternion {
139139
#ifdef MATH_CHECKS
140140
ERR_FAIL_COND_MSG(p_v0.is_zero_approx() || p_v1.is_zero_approx(), "The vectors must not be zero.");
141141
#endif
142-
constexpr real_t ALMOST_ONE = 1.0f - (real_t)CMP_EPSILON;
142+
#ifdef REAL_T_IS_DOUBLE
143+
constexpr real_t ALMOST_ONE = 0.999999999999999;
144+
#else
145+
constexpr real_t ALMOST_ONE = 0.99999975f;
146+
#endif
143147
Vector3 n0 = p_v0.normalized();
144148
Vector3 n1 = p_v1.normalized();
145149
real_t d = n0.dot(n1);
@@ -162,6 +166,7 @@ struct [[nodiscard]] Quaternion {
162166
z = c.z * rs;
163167
w = s * 0.5f;
164168
}
169+
normalize();
165170
}
166171
};
167172

0 commit comments

Comments
 (0)