예제 #1
0
 /// <summary>Constructs and initializes a Vector2f from the specified Vector2f.</summary>
 /// <remarks>Constructs and initializes a Vector2f from the specified Vector2f.</remarks>
 /// <param name="v1">the Vector2f containing the initialization x y data</param>
 public Vector2f(Vector2f v1)
     : base(v1)
 {
 }
예제 #2
0
 // Combatible with 1.1
 /// <summary>Computes the dot product of the this vector and vector v1.</summary>
 /// <remarks>Computes the dot product of the this vector and vector v1.</remarks>
 /// <param name="v1">the other vector</param>
 public float Dot(Vector2f v1)
 {
     return (this.x * v1.x + this.y * v1.y);
 }
예제 #3
0
 /// <summary>Sets the value of this vector to the normalization of vector v1.</summary>
 /// <remarks>Sets the value of this vector to the normalization of vector v1.</remarks>
 /// <param name="v1">the un-normalized vector</param>
 public void Normalize(Vector2f v1)
 {
     float norm;
     norm = (float)(1.0 / Math.Sqrt(v1.x * v1.x + v1.y * v1.y));
     this.x = v1.x * norm;
     this.y = v1.y * norm;
 }
예제 #4
0
 /// <summary>
 /// Returns the angle in radians between this vector and the vector
 /// parameter; the return value is constrained to the range [0,PI].
 /// </summary>
 /// <remarks>
 /// Returns the angle in radians between this vector and the vector
 /// parameter; the return value is constrained to the range [0,PI].
 /// </remarks>
 /// <param name="v1">the other vector</param>
 /// <returns>the angle in radians in the range [0,PI]</returns>
 public float Angle(Vector2f v1)
 {
     double vDot = this.Dot(v1) / (this.Length() * v1.Length());
     if (vDot < -1.0)
     {
         vDot = -1.0;
     }
     if (vDot > 1.0)
     {
         vDot = 1.0;
     }
     return ((float)(Math.Acos(vDot)));
 }