Matrix.h 639 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef MATRIX_H
  2. #define MATRIX_H
  3. #include <iostream>
  4. class Matrix final {
  5. public:
  6. Matrix();
  7. Matrix& set(const Matrix& other);
  8. Matrix& setToIdentity();
  9. Matrix& set(uint index, float f);
  10. const float* getValues() const;
  11. Matrix& mul(const Matrix& m);
  12. Matrix& scale(float sx, float sy);
  13. Matrix& scale(float s);
  14. Matrix& translate(float tx, float ty);
  15. Matrix& translateX(float tx);
  16. Matrix& translateY(float ty);
  17. Matrix& translateTo(float tx, float ty);
  18. Matrix& rotate(float degrees);
  19. private:
  20. float data[9];
  21. };
  22. std::ostream& operator<<(std::ostream& os, const Matrix& m);
  23. #endif