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