add operator - and + and Offset method
This commit is contained in:
parent
861622bac3
commit
3557d81a55
14
MBS.Framework/Drawing/Vector.cs
Executable file → Normal file
14
MBS.Framework/Drawing/Vector.cs
Executable file → Normal file
@ -34,6 +34,15 @@ namespace MBS.Framework.Drawing
|
||||
return (this.X.Equals(other.X) && this.Y.Equals(other.Y));
|
||||
}
|
||||
|
||||
public static Vector2D operator -(Vector2D left, Vector2D right)
|
||||
{
|
||||
return new Vector2D(right.X - left.X, right.Y - left.Y);
|
||||
}
|
||||
public static Vector2D operator +(Vector2D left, Vector2D right)
|
||||
{
|
||||
return new Vector2D(right.X + left.X, right.Y + left.Y);
|
||||
}
|
||||
|
||||
public static bool operator ==(Vector2D left, Vector2D right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
@ -52,6 +61,11 @@ namespace MBS.Framework.Drawing
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
public Vector2D Offset(Vector2D value)
|
||||
{
|
||||
return new Vector2D(this.X + value.X, this.Y + value.Y);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user