public static IVector3 Normalize(IVector3 v)
    {
        IFloat mag = v.Magnitude();

        if (mag == 0)
        {
            return(IVector3.zero);
        }
        return(v / mag);
    }
Exemple #2
0
 public static Vector3 Normalize(this IVector3 vector)
 => vector.Div(vector.Magnitude());
Exemple #3
0
 /// <summary>
 /// Normalize a vector
 /// </summary>
 /// <param name="v">Vector to be normalized</param>
 /// <param name="norm">Normalised vector</param>
 /// <returns>Normalized result vector a/|a|</returns>
 public static IVector3 Normalize(this IVector3 v, ref IVector3 norm)
 {
     return(v.Div(v.Magnitude(), ref norm));
 }