예제 #1
0
 public static Vec2d operator -(Vec2d a, double b)
 {
     Vec2d v = new Vec2d();
     v.X = a.X - b;
     v.Y = a.Y - b;
     return v;
 }
예제 #2
0
 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;
 }
예제 #3
0
 public static Vec2d operator -(Vec2d v)
 {
     Vec2d vec = new Vec2d();
     vec.X = -v.X;
     vec.Y = -v.Y;
     return vec;
 }
예제 #4
0
 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;
 }
예제 #5
0
 public static Vec2d operator /(double s, Vec2d v)
 {
     Vec2d vec = new Vec2d();
     vec.X = s / v.X;
     vec.Y = s / v.Y;
     return vec;
 }