Exemple #1
0
 /// <summary>
 /// Enforce orthogonality between two vectors.
 /// </summary>
 private static void EnforceOrthogonality(Vector3 v, ref Vector3 vOrthogonal)
 {
     if (Math.Abs(Vector3.Dot(v, vOrthogonal)) > LinearAlgebra.EpsilonSingleWeak)
     {
         vOrthogonal = vOrthogonal.ProjectOrthogonal(v);
         if (vOrthogonal.IsNearZero())
             throw new Exception("Cannot enforce orthogonality on parallel vectors");
         vOrthogonal.Normalize();
     }
 }