2using System.Runtime.Serialization;
9 [DataContract(Namespace = Constants.DataContractNamespace)]
10 public struct Vector2DInt : IEquatable<Vector2DInt>, IComparable<Vector2DInt>
25 [DataMember(Order = 0)]
26 public int X {
get;
private set; }
31 [DataMember(Order = 1)]
32 public int Y {
get;
private set; }
53 return $
"Vector2DInt({X}, {Y})";
57 public override bool Equals(
object obj)
65 return X == other.
X &&
72 var comparison =
X.CompareTo(other.
X);
77 return Y.CompareTo(other.
Y);
83 int hashCode = 1861411795;
84 hashCode = hashCode * -1521134295 +
X.GetHashCode();
85 hashCode = hashCode * -1521134295 +
Y.GetHashCode();
98 return !(left == right);
126 return new Vector2DInt(Math.Max(value1.
X, value2.
X), Math.Max(value1.
Y, value2.
Y));
136 return new Vector2DInt(Math.Min(value1.
X, value2.
X), Math.Min(value1.
Y, value2.
Y));
145 return new Vector2DInt(Math.Sign(vector.
X), Math.Sign(vector.
Y));
155 return value1.
X * value2.
X + value1.
Y * value2.
Y;
A 2D vector with integer values.
Vector3DInt To3D()
Converts the vector to a 3D vector with a Z value of zero.
static Vector2DInt operator-(Vector2DInt left, Vector2DInt right)
static Vector2DInt operator+(Vector2DInt left, Vector2DInt right)
static Vector2DInt One
Returns a vector of ones.
static Vector2DInt Min(Vector2DInt value1, Vector2DInt value2)
Returns the minimum values of the two vectors.
Vector2DInt(int x, int y)
Initializes a new vector.
bool Equals(Vector2DInt other)
override int GetHashCode()
static bool operator==(Vector2DInt left, Vector2DInt right)
int CompareTo(Vector2DInt other)
static bool operator!=(Vector2DInt left, Vector2DInt right)
override string ToString()
override bool Equals(object obj)
static Vector2DInt Zero
Returns a zero vector.
static Vector2DInt Max(Vector2DInt value1, Vector2DInt value2)
Returns the maximum values of the two vectors.
static Vector2DInt Sign(Vector2DInt vector)
Returns the sign of the vector.
static int Dot(Vector2DInt value1, Vector2DInt value2)
Returns the dot product of the two vectors.
A 3D vector with integer values.