CmORect.h 753 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include "CmPrerequisitesUtil.h"
  3. #include "CmVector2.h"
  4. #include "CmRect.h"
  5. #include "CmMatrix4.h"
  6. namespace CamelotFramework
  7. {
  8. /**
  9. * @brief Oriented rectangle. Can be rotated/translated/scaled. Skewing and similar transformations
  10. * are not supported.
  11. * TODO - Can be made faster. Speed wasn't my concern when designing the class.
  12. */
  13. class CM_UTILITY_EXPORT ORect
  14. {
  15. public:
  16. ORect();
  17. ORect(const Rect& rect);
  18. void applyTransform(const Matrix4& tfrm);
  19. bool contains(const Vector2& point);
  20. Vector2 getMin() const;
  21. Vector2 getMax() const;
  22. private:
  23. Vector2 mOrigin;
  24. Vector2 mSides[2];
  25. float mSideLengths[2]; // Redundant but I want my side normals to be normalized
  26. };
  27. }