public static Vec2d operator -(Vec2d a, double b) { Vec2d v = new Vec2d(); v.X = a.X - b; v.Y = a.Y - b; return v; }
public static Vec2d operator /(Vec2d a, Vec2d b) { Vec2d v = new Vec2d(); v.X = a.X / b.X; v.Y = a.Y / b.Y; return v; }
public static Vec2d operator -(Vec2d v) { Vec2d vec = new Vec2d(); vec.X = -v.X; vec.Y = -v.Y; return vec; }
public static Vec2d operator /(Vec2d v, double s) { Vec2d vec = new Vec2d(); // Division of doubles can be expensive, // so we multiply instead, as it's much cheaper. double num = 1f / s; vec.X = v.X * num; vec.Y = v.Y * num; return vec; }
public static Vec2d operator /(double s, Vec2d v) { Vec2d vec = new Vec2d(); vec.X = s / v.X; vec.Y = s / v.Y; return vec; }