Matrix2.hpp
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <etk/math/Vector2D.hpp>
10 #include <etk/types.hpp>
11 namespace etk {
15  class Matrix2 {
16  public:
22  float m_mat[2*3];
23  public:
27  Matrix2();
32  Matrix2(const Matrix2& _obj);
42  Matrix2(float _sx,
43  float _shy,
44  float _shx,
45  float _sy,
46  float _tx,
47  float _ty);
52  Matrix2(const float* _values);
57  Matrix2(const double* _values);
61  void identity();
67  const Matrix2& operator= (const Matrix2& _obj );
74  bool operator== (const Matrix2& _obj) const;
81  bool operator!= (const Matrix2& _obj) const;
87  const Matrix2& operator+= (const Matrix2& _obj);
93  Matrix2 operator+ (const Matrix2& _obj) const;
99  const Matrix2& operator-= (const Matrix2& _obj);
105  Matrix2 operator- (const Matrix2& _obj) const;
111  const Matrix2& operator *= (const Matrix2& _obj);
117  Matrix2 operator * (const Matrix2& _obj);
123  vec2 operator * (const vec2& _point) const;
129  vec2 applyScaleRotation(const vec2& _point) const;
134  Matrix2 operator ~ () const;
138  void flipX();
142  void flipY();
147  void scale(const vec2& _vect);
152  void scale(float _value);
157  void rotate(float _angleRad);
162  void translate(const vec2& _vect);
167  float determinant() const;
173  void invert();
174  };
180  Matrix2 mat2Rotate(float _angleRad);
186  Matrix2 mat2Scale(const vec2& _scale);
192  Matrix2 mat2Scale(float _scale);
198  Matrix2 mat2Translate(const vec2& _translate);
204  Matrix2 mat2Skew(const vec2& _skew);
206  std::ostream& operator <<(std::ostream& _os, const etk::Matrix2& _obj);
207 }
208 // simplify using of matrix ...
210 
211 
float m_mat[2 *3]
Internal data sx shx tx sy shy ty.
Definition: Matrix2.hpp:22
Matrix2()
Constructor that load identity.
vec2 applyScaleRotation(const vec2 &_point) const
Apply matrix on a vector Scale Rotate, but NOT the translation.
void invert()
Inverts the matrix.
void scale(const vec2 &_vect)
Scale the current Matrix.
basic namespace of the etk library. (it might contain all the etk fuctions/class/structures without m...
Definition: Archive.hpp:16
void translate(const vec2 &_vect)
Makes a translation of the matrix.
Matrix2 operator-(const Matrix2 &_obj) const
Operator- Decrement an other matrix with this one.
float determinant() const
Computes the determinant of the matrix.
Matrix2 operator+(const Matrix2 &_obj) const
Operator+ Addition an other matrix with this one.
bool operator!=(const Matrix2 &_obj) const
In-Equality compare operator with an other object.
Matrix2 operator*(const Matrix2 &_obj)
Operator* Multiplication an other matrix with this one.
bool operator==(const Matrix2 &_obj) const
Equality compare operator with an other object.
Matrix2 mat2Rotate(float _angleRad)
Create a matrix 2D with a simple rotation.
void flipY()
Flip the mathix threw the Y axis.
const Matrix2 & operator=(const Matrix2 &_obj)
Operator= Asign the current object with an other object.
void rotate(float _angleRad)
Makes a rotation matrix.
Matrix2 mat2Skew(const vec2 &_skew)
Create a matrix 2D with a simple skew.
Vectorial 2-dimention vector (x/y)
Definition: Vector2D.hpp:18
const Matrix2 & operator+=(const Matrix2 &_obj)
Operator+= Addition an other matrix with this one.
void flipX()
Flip the mathix threw the X axis.
void identity()
Load Identity matrix.
const Matrix2 & operator*=(const Matrix2 &_obj)
Operator*= Multiplication an other matrix with this one.
Matrix2 operator~() const
Inverse the current Matrix.
Matrix2 mat2Scale(const vec2 &_scale)
Create a matrix 2D with a simple scale.
Matrix2 mat2Translate(const vec2 &_translate)
Create a matrix 2D with a simple translation.
Transformation matrix for vector 2D.
Definition: Matrix2.hpp:15
const Matrix2 & operator-=(const Matrix2 &_obj)
Operator-= Decrement an other matrix with this one.