packages/Utils/utils/Vector_Functions.hh
//---------------------------------------------------------------------------//
/*!
 * \brief Normalize a vector so that its magnitude is one.
 *
 * Convert a vector into a unit-vector using,
 * \f[
   \hat{\mathbf{V}} = \frac{\mathbf{V}}{|\mathbf{V}|},
 * \f]
 *
 * This function is unrolled for efficiency, which is why we don't have a
 * general normalize function.
 */
\brief Normalize a vector so that its magnitude is one.

This function is unrolled for efficiency, which is why we don't have a
general normalize function.
\ brief Normalize a vector so that its magnitude is one . This function is unrolled for efficiency which is why we don ' t have a general normalize function .
inline void vector_normalize(def::Space_Vector &vector)
{
    double norm     = 1.0 / vector_magnitude(vector);
    vector[def::X] *= norm;
    vector[def::Y] *= norm;
    vector[def::Z] *= norm;
    ENSURE(soft_equiv(vector_magnitude(vector), 1.0, 1.0e-6));
}
inline void vector_normalize ( def :: Space_Vector & vector ) { double norm = 1.0 / vector_magnitude ( vector ) ; vector [ def :: X ] *= norm ; vector [ def :: Y ] *= norm ; vector [ def :: Z ] *= norm ; ENSURE ( soft_equiv ( vector_magnitude ( vector ) , 1.0 , 1.0e-6 ) ) ; }
\brief Normalize a vector so that its magnitude is one.
\ brief Normalize a vector so that its magnitude is one .