Point2D.cs 493 B

123456789101112131415161718192021222324
  1. namespace Masuit.Tools.Maths;
  2. public class Point2D
  3. {
  4. public double X { get; set; }
  5. public double Y { get; set; }
  6. public Point2D(double x, double y)
  7. {
  8. X = x;
  9. Y = y;
  10. }
  11. public static Vector2D operator -(Point2D first, Point2D second)
  12. {
  13. return new Vector2D(first.X - second.X, first.Y - second.Y);
  14. }
  15. public static Point2D operator +(Point2D pt, Vector2D vec)
  16. {
  17. return new Point2D(pt.X + vec.X, pt.Y + vec.Y);
  18. }
  19. }