Beispiel #1
0
 // Получить отношение векторов: параллельны, перпендикулярны, остальное
 public static VectorRelation GetRelation(this Vector v, Vector u)
 {
     if (Math.Abs(v.CrossProduct(u)) == 0)
     {
         return(VectorRelation.Parallel);
     }
     else if (Math.Abs(v.DotProduct(u)) == 0)
     {
         return(VectorRelation.Orthogonal);
     }
     return(VectorRelation.General);
 }
Beispiel #2
0
 /// <summary>
 /// Получить угол между векторами в радианах
 /// </summary>
 /// <param name="v"></param>
 /// <param name="u"></param>
 /// <returns></returns>
 public static double GetAngleBetween(this Vector v, Vector u)
 {
     return(Math.Atan2(v.CrossProduct(u), v.DotProduct(u)));
 }