|
@@ -100,7 +100,7 @@ void Quat::set_euler_yxz(const Vector3 &p_euler) {
|
|
|
// This implementation uses YXZ convention (Z is the first rotation).
|
|
|
Vector3 Quat::get_euler_yxz() const {
|
|
|
#ifdef MATH_CHECKS
|
|
|
- ERR_FAIL_COND_V(!is_normalized(), Vector3(0, 0, 0));
|
|
|
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Vector3(0, 0, 0), "The quaternion must be normalized.");
|
|
|
#endif
|
|
|
Basis m(*this);
|
|
|
return m.get_euler_yxz();
|
|
@@ -145,15 +145,15 @@ bool Quat::is_normalized() const {
|
|
|
|
|
|
Quat Quat::inverse() const {
|
|
|
#ifdef MATH_CHECKS
|
|
|
- ERR_FAIL_COND_V(!is_normalized(), Quat());
|
|
|
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Quat(), "The quaternion must be normalized.");
|
|
|
#endif
|
|
|
return Quat(-x, -y, -z, w);
|
|
|
}
|
|
|
|
|
|
Quat Quat::slerp(const Quat &q, const real_t &t) const {
|
|
|
#ifdef MATH_CHECKS
|
|
|
- ERR_FAIL_COND_V(!is_normalized(), Quat());
|
|
|
- ERR_FAIL_COND_V(!q.is_normalized(), Quat());
|
|
|
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Quat(), "The start quaternion must be normalized.");
|
|
|
+ ERR_FAIL_COND_V_MSG(!q.is_normalized(), Quat(), "The end quaternion must be normalized.");
|
|
|
#endif
|
|
|
Quat to1;
|
|
|
real_t omega, cosom, sinom, scale0, scale1;
|
|
@@ -199,8 +199,8 @@ Quat Quat::slerp(const Quat &q, const real_t &t) const {
|
|
|
|
|
|
Quat Quat::slerpni(const Quat &q, const real_t &t) const {
|
|
|
#ifdef MATH_CHECKS
|
|
|
- ERR_FAIL_COND_V(!is_normalized(), Quat());
|
|
|
- ERR_FAIL_COND_V(!q.is_normalized(), Quat());
|
|
|
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Quat(), "The start quaternion must be normalized.");
|
|
|
+ ERR_FAIL_COND_V_MSG(!q.is_normalized(), Quat(), "The end quaternion must be normalized.");
|
|
|
#endif
|
|
|
const Quat &from = *this;
|
|
|
|
|
@@ -221,8 +221,8 @@ Quat Quat::slerpni(const Quat &q, const real_t &t) const {
|
|
|
|
|
|
Quat Quat::cubic_slerp(const Quat &q, const Quat &prep, const Quat &postq, const real_t &t) const {
|
|
|
#ifdef MATH_CHECKS
|
|
|
- ERR_FAIL_COND_V(!is_normalized(), Quat());
|
|
|
- ERR_FAIL_COND_V(!q.is_normalized(), Quat());
|
|
|
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Quat(), "The start quaternion must be normalized.");
|
|
|
+ ERR_FAIL_COND_V_MSG(!q.is_normalized(), Quat(), "The end quaternion must be normalized.");
|
|
|
#endif
|
|
|
//the only way to do slerp :|
|
|
|
real_t t2 = (1.0 - t) * t * 2;
|
|
@@ -238,7 +238,7 @@ Quat::operator String() const {
|
|
|
|
|
|
void Quat::set_axis_angle(const Vector3 &axis, const real_t &angle) {
|
|
|
#ifdef MATH_CHECKS
|
|
|
- ERR_FAIL_COND(!axis.is_normalized());
|
|
|
+ ERR_FAIL_COND_MSG(!axis.is_normalized(), "The axis Vector3 must be normalized.");
|
|
|
#endif
|
|
|
real_t d = axis.length();
|
|
|
if (d == 0)
|