Example #1
0
const Vector3& Vector3::Normalize()
{
	double length2 = GetLengthSquared();

	if (math::NearZero((float)length2))
	{
		SD_ERROR_MSG("Division by zero!");
		return *this;
	}

	// Not need to normalize
	if(length2 == 1.0f)
		return *this;

	return (*this /= (float)sqrt(length2));
}
Example #2
0
		Scalar
			GetApproximateLength() const
				{
					Check_Object(this);
					return SqrtApproximate(static_cast<Scalar>(GetLengthSquared()));
				}
Example #3
0
		Scalar
			GetLength() const
				{return Sqrt(GetLengthSquared());}
Example #4
0
		Scalar
			GetApproximateLength() const
				{return SqrtApproximate(GetLengthSquared());}
Example #5
0
void Quaternion::Invert()
{
    Conjugate();

    *this /= GetLengthSquared();
}