public static BVector operator -(BVector a) { BVector ret = new BVector(); ret.x = - a.x; ret.y = - a.y; return ret; }
public static BVector operator *(BVector a, float b) { BVector ret = new BVector(); ret.x = a.x * b; ret.y = a.y * b; return ret; }
public static BVector operator +(BVector a, BVector b) { BVector ret = new BVector(); ret.x = a.x + b.x; ret.y = a.y + b.y; return ret; }
static void Main(string[] args) { BVector v1, v2, v3; v1 = new BVector(5, 8); v2 = new BVector(2, 5); v3 = v1 + v2; Console.WriteLine("v1: " + v1); Console.WriteLine("v2: " + v2); Console.WriteLine("v3: " + v3); v1 += v2; v1 = v2 - v3; float f = 10.0f; v1.X = 5; v1.Y = 5; v2 = v1 * f; Console.WriteLine(v2); Console.ReadLine(); }
public static BVector operator -(BVector a, BVector b) { BVector ret = new BVector(); ret = a + (-b); return ret; }