When I'm trying to merge my code with the svn version, I found some update like:
In irricht 1.7.2 vector2d.h
Code: Select all
//! Normalize the vector.
/** The null vector is left untouched.
\return Reference to this vector, after normalization. */
vector2d<T>& normalize()
{
f32 length = (f32)(X*X + Y*Y);
if (core::equals(length, 0.f))
return *this;
length = core::reciprocal_squareroot ( length );
X = (T)(X * length);
Y = (T)(Y * length);
return *this;
}
Code: Select all
//! Normalizes the vector.
/** In case of the 0 vector the result is still 0, otherwise
the length of the vector will be 1.
\return Reference to this vector after normalization. */
vector3d<T>& normalize()
{
f64 length = X*X + Y*Y + Z*Z;
if (length == 0 ) // this check isn't an optimization but prevents getting NAN in the sqrt.
return *this;
length = core::reciprocal_squareroot(length);
X = (T)(X * length);
Y = (T)(Y * length);
Z = (T)(Z * length);
return *this;
}
if (core::equals(length, 0.f))
if (length == 0 )
Seems 1.7.2 did the right things, Any reason for this update?