Пример #1
0
 /// <summary>
 /// The maximum value between each component in vectors.
 /// </summary>
 public void Max(Vector2i v)
 {
     x = Math.Max(x, v.x);
     y = Math.Max(y, v.y);
 }
Пример #2
0
 /// <summary>
 /// Clamp the each component to specified min and max.
 /// </summary>
 public void Clamp(Vector2i min, Vector2i max)
 {
     x = Math.Max(Math.Min(x, max.x), min.x);
     y = Math.Max(Math.Min(y, max.y), min.y);
 }
Пример #3
0
 /// <summary>
 /// The minimum value between each component in vectors.
 /// </summary>
 public void Min(Vector2i v)
 {
     x = Math.Min(x, v.x);
     y = Math.Min(y, v.y);
 }
Пример #4
0
 /// <summary>
 /// Distance between two vectors.
 /// </summary>
 public static double Distance(Vector2i v0, Vector2i v1)
 {
     return(Math.Sqrt(SqrDistance(v0, v1)));
 }
Пример #5
0
 /// <summary>
 /// Cross two vectors.
 /// </summary>
 public static int Cross(Vector2i v0, Vector2i v1)
 {
     return(v0.x * v1.y - v0.y * v1.x);
 }
Пример #6
0
 /// <summary>
 /// The dot product of two vectors.
 /// </summary>
 public static int Dot(Vector2i v0, Vector2i v1)
 {
     return(v0.x * v1.x + v0.y * v1.y);
 }
Пример #7
0
 /// <summary>
 /// Are these vectors equal.
 /// </summary>
 public bool Equals(Vector2i v)
 {
     return(this == v);
 }