public bool Equals(VectorInt other) { if (_hashCode != other.GetHashCode() || Length != other.Length) { return(false); } for (int i = 0; i < other.Length; ++i) { // ReSharper disable once CompareOfFloatsByEqualityOperator if (_values[i] != other._values[i]) { return(false); } } return(true); }
public static VectorInt Add(VectorInt vector1, VectorInt vector2) { var length = vector1._values.Length; if (length != vector2.Length) { throw new ArgumentException("Vectors must have equal length"); } var newVectorValues = new int[length]; for (var i = 0; i < length; ++i) { newVectorValues[i] = vector1.GetValue(i) + vector2.GetValue(i); } return(new VectorInt(newVectorValues)); }
public static Vector2 operator /(Vector2Int vector1, float number) { return(new Vector2(VectorInt.Div(vector1.GetVector(), number))); }
public static Vector2Int operator -(Vector2Int vector1, Vector2Int vector2) { return(new Vector2Int(VectorInt.Sub(vector1.GetVector(), vector2.GetVector()))); }
public Vector2Int(int x, int y) { _innerVector = new VectorInt(x, y); X = x; Y = y; }
public static VectorInt Sub(VectorInt vector1, VectorInt vector2) { return(Add(vector1, vector2.GetReverse())); }