UnitQuaternion& UnitQuaternion::FastNormalize() { if (!UseFastNormalize) return Normalize(); Scalar t = x*x + y*y + z*z; if (t <= 1.0f) { t = SqrtApproximate(1.0f - t); if (w<0.0f) { x = -x; y = -y; z = -z; } w = t; TestInstance(); } else { t = SqrtApproximate(t); t = 1.0f/t; x *= t; y *= t; z *= t; w = 0.0f; TestInstance(); } return *this; }
Scalar GetApproximateLength() const { Check_Object(this); return SqrtApproximate(static_cast<Scalar>(GetLengthSquared())); }
Scalar GetApproximateLength() const {return SqrtApproximate(GetLengthSquared());}