fork download
  1. struct Position
  2. {
  3. int x;
  4. int y;
  5. };
  6.  
  7. class AABB
  8. {
  9. public:
  10. AABB(Position min, Position max):
  11. min(min),
  12. max(max)
  13. {
  14. ;
  15. }
  16.  
  17. friend bool checkCollision(const AABB& first, const AABB& second)
  18. {
  19. return (!(first.min.x > second.max.x || first.min.y > second.max.y ||
  20. first.max.x < second.min.x || first.max.y < second.min.y));
  21. }
  22.  
  23. private:
  24. Position min;
  25. Position max;
  26. };
  27.  
  28. int main()
  29. {
  30. return 0;
  31. }
Success #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty