Exemplo n.º 1
0
 /// <summary>
 /// Returns the angle between two NetronVectors
 /// </summary>
 /// <param name="v1">a vector</param>
 /// <param name="v2">a vector</param>
 /// <returns></returns>
 public static double Angle(NetronVector v1, NetronVector v2)
 {
     if ((v1.Length() > 0) && (v2.Length() > 0))
     {
         return(Math.Acos(v1.DotProduct(v2) / (v1.Length() * v2.Length())));
     }
     else
     {
         return(0);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Sets this vector to the project of the original onto the given vector
 /// </summary>
 /// <param name="v">the vector onto which this vector is projected</param>
 public void ProjectionEquals(NetronVector v)
 {
     this.SetTo(v.Multiply((this.DotProduct(v)) / (v.DotProduct(v))));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Returns the projection of this vector on the given one
 /// </summary>
 /// <param name="v">the vector onto which this vector is projected</param>
 /// <returns>the resulting vector</returns>
 public NetronVector Projection(NetronVector v)
 {
     return(v.Multiply((this.DotProduct(v)) / (v.DotProduct(v))));
 }