public IVector2 Sub(IVector2 v) { BufferedVector2d bv = v as BufferedVector2d; if (bv != null) { return(new BufferedVector2d(this.X - bv.X, this.Y - bv.Y)); } Vector2d sv = v as Vector2d; if (sv != null) { return(new BufferedVector2d(this.X - sv.x, this.Y - sv.y)); } return(new BufferedVector2d(this.X - v.GetXDouble(), this.Y - v.GetYDouble())); }
public IVector2 Add(IVector2 v) { BufferedVector2d bv = v as BufferedVector2d; if (bv != null) { return(new BufferedVector2d(this.X + bv.X, this.Y + bv.Y)); } Vector2d sv = v as Vector2d; if (sv != null) { return(new BufferedVector2d(this.X + sv.x, this.Y + sv.y)); } return(new BufferedVector2d(this.X + v.GetXDouble(), this.Y + v.GetYDouble())); }
public void Sub(IVector2 v, IBufferedVector2D result) { BufferedVector2d bv = v as BufferedVector2d; if (bv != null) { result.SetCoords(this.X - bv.X, this.Y - bv.Y); return; } Vector2d sv = v as Vector2d; if (sv != null) { result.SetCoords(this.X - sv.x, this.Y - sv.y); return; } result.SetCoords(this.X - v.GetXDouble(), this.Y - v.GetYDouble()); }
public static void Add2(IVector2 a, IVector2 b, IBufferedVector2D result) { result.SetCoords(a.GetXDouble() + b.GetXDouble(), a.GetYDouble() + b.GetYDouble()); }
public void Add2(IVector2 v, IBufferedVector2D result) { result.SetCoords(this.X + v.GetXDouble(), this.Y + v.GetYDouble()); }