Point.h 427 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "Common.h"
  3. NS_BF_BEGIN;
  4. template <typename T>
  5. class Point
  6. {
  7. public:
  8. T x;
  9. T y;
  10. public:
  11. Point(T x = 0, T y = 0)
  12. {
  13. this->x = x;
  14. this->y = y;
  15. }
  16. Point operator+(Point rhs)
  17. {
  18. return Point(x + rhs.x, y + rhs.y);
  19. }
  20. Point operator-(Point rhs)
  21. {
  22. return Point(x - rhs.x, y - rhs.y);
  23. }
  24. };
  25. typedef Point<double> PointD;
  26. typedef Point<float> PointF;
  27. typedef Point<int32> PointI32;
  28. NS_BF_END;