Matrix3.pkg 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. $#include "Matrix3.h"
  2. /// 3x3 matrix for rotation and scaling.
  3. class Matrix3
  4. {
  5. public:
  6. /// Construct undefined.
  7. Matrix3();
  8. /// Copy-construct from another matrix.
  9. Matrix3(const Matrix3& matrix);
  10. /// Construct from values.
  11. Matrix3(float v00, float v01, float v02,
  12. float v10, float v11, float v12,
  13. float v20, float v21, float v22);
  14. /// Test for equality with another matrix without epsilon.
  15. bool operator == (const Matrix3& rhs) const;
  16. /// Multiply a Vector3.
  17. Vector3 operator * (const Vector3& rhs) const;
  18. /// Add a matrix.
  19. Matrix3 operator + (const Matrix3& rhs) const;
  20. /// Subtract a matrix.
  21. Matrix3 operator - (const Matrix3& rhs) const;
  22. /// Multiply with a scalar.
  23. Matrix3 operator * (float rhs) const;
  24. /// Multiply a matrix.
  25. Matrix3 operator * (const Matrix3& rhs) const;
  26. /// Set scaling elements.
  27. void SetScale(const Vector3& scale);
  28. /// Set uniform scaling elements.
  29. void SetScale(float scale);
  30. /// Return the scaling part.
  31. Vector3 Scale() const;
  32. /// Return transpose.
  33. Matrix3 Transpose() const;
  34. /// Return scaled by a vector.
  35. Matrix3 Scaled(const Vector3& scale) const;
  36. /// Test for equality with another matrix with epsilon.
  37. bool Equals(const Matrix3& rhs) const;
  38. /// Return inverse.
  39. Matrix3 Inverse() const;
  40. float m00_ @ m00;
  41. float m01_ @ m01;
  42. float m02_ @ m02;
  43. float m10_ @ m10;
  44. float m11_ @ m11;
  45. float m12_ @ m12;
  46. float m20_ @ m20;
  47. float m21_ @ m21;
  48. float m22_ @ m22;
  49. /// Bulk transpose matrices.
  50. static void BulkTranspose(float* dest, const float* src, unsigned count);
  51. /// Zero matrix.
  52. static const Matrix3 ZERO;
  53. /// Identity matrix.
  54. static const Matrix3 IDENTITY;
  55. };