示例#1
0
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;
}
示例#2
0
		Scalar
			GetApproximateLength() const
				{
					Check_Object(this);
					return SqrtApproximate(static_cast<Scalar>(GetLengthSquared()));
				}
示例#3
0
		Scalar
			GetApproximateLength() const
				{return SqrtApproximate(GetLengthSquared());}