Пример #1
0
 /// <summary>
 /// Set the ith column from avector.
 /// </summary>
 public void SetColumn(int iCol, Vector2f v)
 {
     this[0, iCol] = v.x;
     this[1, iCol] = v.y;
 }
Пример #2
0
 /// <summary>
 /// Set the ith row from avector.
 /// </summary>
 public void SetRow(int iRow, Vector2f v)
 {
     this[iRow, 0] = v.x;
     this[iRow, 1] = v.y;
 }
Пример #3
0
 /// <summary>
 /// The maximum value between each component in vectors.
 /// </summary>
 public void Max(Vector2f v)
 {
     x = Math.Max(x, v.x);
     y = Math.Max(y, v.y);
 }
Пример #4
0
 /// <summary>
 /// Clamp the each component to specified min and max.
 /// </summary>
 public void Clamp(Vector2f min, Vector2f max)
 {
     x = Math.Max(Math.Min(x, max.x), min.x);
     y = Math.Max(Math.Min(y, max.y), min.y);
 }
Пример #5
0
 /// <summary>
 /// The minimum value between each component in vectors.
 /// </summary>
 public void Min(Vector2f v)
 {
     x = Math.Min(x, v.x);
     y = Math.Min(y, v.y);
 }
Пример #6
0
 /// <summary>
 /// Distance between two vectors.
 /// </summary>
 public static float Distance(Vector2f v0, Vector2f v1)
 {
     return(FMath.SafeSqrt(SqrDistance(v0, v1)));
 }
Пример #7
0
 /// <summary>
 /// Cross two vectors.
 /// </summary>
 public static float Cross(Vector2f v0, Vector2f v1)
 {
     return(v0.x * v1.y - v0.y * v1.x);
 }
Пример #8
0
 /// <summary>
 /// The dot product of two vectors.
 /// </summary>
 public static float Dot(Vector2f v0, Vector2f v1)
 {
     return(v0.x * v1.x + v0.y * v1.y);
 }
Пример #9
0
 /// <summary>
 /// Are these vectors equal.
 /// </summary>
 public bool Equals(Vector2f v)
 {
     return(this == v);
 }