2using System.Runtime.Serialization;
9 [DataContract(Namespace = Constants.DataContractNamespace)]
10 public struct Vector3DInt : IEquatable<Vector3DInt>, IComparable<Vector3DInt>
25 [DataMember(Order = 0)]
26 public int X {
get;
private set; }
31 [DataMember(Order = 1)]
32 public int Y {
get;
private set; }
37 [DataMember(Order = 2)]
38 public int Z {
get;
private set; }
61 return $
"Vector3DInt({X}, {Y}, {Z})";
65 public override bool Equals(
object obj)
73 return X == other.
X &&
81 var comparison =
X.CompareTo(other.
X);
86 comparison =
Y.CompareTo(other.
Y);
91 return Z.CompareTo(other.
Z);
97 int hashCode = -307843816;
98 hashCode = hashCode * -1521134295 +
X.GetHashCode();
99 hashCode = hashCode * -1521134295 +
Y.GetHashCode();
100 hashCode = hashCode * -1521134295 +
Z.GetHashCode();
107 return left.
Equals(right);
113 return !(left == right);
141 return new Vector3DInt(Math.Max(value1.
X, value2.
X), Math.Max(value1.
Y, value2.
Y), Math.Max(value1.
Z, value2.
Z));
151 return new Vector3DInt(Math.Min(value1.
X, value2.
X), Math.Min(value1.
Y, value2.
Y), Math.Min(value1.
Z, value2.
Z));
160 return new Vector3DInt(Math.Sign(vector.
X), Math.Sign(vector.
Y), Math.Sign(vector.
Z));
170 return value1.
X * value2.
X + value1.
Y * value2.
Y + value1.
Z * value2.
Z;
A 2D vector with integer values.
A 3D vector with integer values.
static Vector3DInt Min(Vector3DInt value1, Vector3DInt value2)
Returns the minimum values of the two vectors.
static int Dot(Vector3DInt value1, Vector3DInt value2)
Returns the dot product of the two vectors.
Vector3DInt(int x, int y, int z)
Initializes a new vector.
static bool operator!=(Vector3DInt left, Vector3DInt right)
static bool operator==(Vector3DInt left, Vector3DInt right)
static Vector3DInt operator-(Vector3DInt left, Vector3DInt right)
bool Equals(Vector3DInt other)
override int GetHashCode()
static Vector3DInt Zero
Returns a zero vector.
override string ToString()
override bool Equals(object obj)
static Vector3DInt One
Returns a vector of ones.
static Vector3DInt Max(Vector3DInt value1, Vector3DInt value2)
Returns the maximum values of the two vectors.
static Vector3DInt operator+(Vector3DInt left, Vector3DInt right)
static Vector3DInt Sign(Vector3DInt vector)
Returns the sign of the vector.
Vector2DInt To2D()
Converts the vector to a 2D vector, without the Z value.
int CompareTo(Vector3DInt other)