using StgSharp.Math; using System; using System.Collections.Generic; using System.Text; namespace StgSharp.Vector { public struct Vec2D:IEquatable { float X; float Y; float Direction; float Length; public Vec2D(float x,float y) { X = x; Y = y; Direction = 0; } public bool Equals(Vec2D other) { if (this.GetHashCode() != other.GetHashCode()) { return false; } else { return this.X == other.X && this.Y == other.Y; } } public override bool Equals(object obj) { if (obj == null) { return false; } else if (obj.GetType() != typeof(Vec2D)) { return false; } else { return this.Equals((Vec2D)obj); } } public override int GetHashCode() { return HashCode.Combine(X, Y); } public override string ToString() { return $"{this.X},{this.Y}"; } public static bool operator ==(Vec2D vec1, Vec2D vec2) { return vec1.X==vec2.X && vec1.Y==vec2.Y; } public static bool operator !=(Vec2D vec1, Vec2D vec2) { return !(vec1.X == vec2.X && vec1.Y == vec2.Y); } public static Vec2D operator +(Vec2D vec1, Vec2D vec2) { return new Vec2D(vec1.X + vec2.X, vec1.Y + vec2.Y); } public static Vec2D operator -(Vec2D vec1, Vec2D vec2) { return new Vec2D(vec1.X + vec2.X, vec1.Y + vec2.Y); } public static } }