![]() |
Scanframe Modular Application 0.1.0
|
Generic 2 x 2 matrix template. More...
#include <TMatrix22.h>
Classes | |
union | data_type |
Storage union of the 2x2 matrix. More... | |
Public Types | |
typedef T | value_type |
Type accessible when implemented. | |
Public Member Functions | |
TMatrix22 () | |
Default constructor. | |
TMatrix22 (const TMatrix22 &m) | |
Copy constructor. | |
TMatrix22 (TMatrix22 &&) noexcept | |
Move constructor. | |
TMatrix22 (std::initializer_list< T > list) | |
Initializer list constructor. | |
TMatrix22 (T m00, T m01, T m10, T m11) | |
Initializing constructor. | |
TMatrix22 (T scale_x, T scale_y) | |
Scaling constructor. | |
TMatrix22 (T angle) | |
Constructs a rotation matrix passing a single angle. | |
TMatrix22 | transposed () const |
Gets the transposed version of the matrix. A transposed rotation matrix inverts the rotation. | |
TMatrix22 & | assign (const T[2][2]) |
Assignment using a 2 by 2 array. | |
TMatrix22 & | assign (value_type m00, value_type m01, value_type m10, value_type m11) |
Assignment using 4 separate values. | |
TMatrix22 & | operator= (const TMatrix22 &m) |
Assignment operator. | |
TMatrix22 & | operator= (TMatrix22 &&m) noexcept |
Assignment move operator. | |
TMatrix22 & | operator*= (const TMatrix22 &m) |
Vector transformation operator. | |
TVector2D< T > | transformed (const TVector2D< T > &) const |
Vector transformation method. | |
TVector2D< T > | operator* (const TVector2D< T > &) const |
Vector transformation operator. | |
constexpr | operator T* () |
Pointer cast operators. | |
constexpr | operator const T * () const |
Const pointer cast operators. | |
bool | isEqual (const TMatrix22 &m, T tol=tolerance) const |
Compares the passed matrix within the set tolerance. | |
bool | operator== (const TMatrix22 &) const |
Compare equal operator using the tolerance for comparing. | |
bool | operator!= (const TMatrix22 &) const |
Compare unequal operator using the tolerance for comparing. | |
TMatrix22 & | resetOrientation () |
Reset the matrix to the so-called 'identity' matrix where a vector is not changed during transformation. | |
void | setRotation (T angle) |
Sets the rotation for the matrix. | |
T | getRotation () const |
Gets the rotation of the matrix when it is a square matrix. | |
std::string | toString () const |
Gets the string representation of the matrix formed like '((m00,m01),(m10,m11))'. | |
TMatrix22 & | fromString (const std::string &s) noexcept(false) |
Gets matrix values from the string representation formed like '({1.2,4.5},{5.6,7.8})'. Throws an exception when the string is not in the correct format. | |
void | copyTo (T[2][2]) const |
Copy to matrix to 2 by 2 value_type array. | |
Static Public Attributes | |
static constexpr auto | tolerance = TVector2D<T>::tolerance |
Tolerance for when comparing in the equal operator. | |
Protected Attributes | |
union sf::TMatrix22::data_type | _data = {0, 0, 0, 0} |
Generic 2 x 2 matrix template.
typedef T sf::TMatrix22< T >::value_type |
Type accessible when implemented.
sf::TMatrix22< T >::TMatrix22 | ( | ) |
Default constructor.
sf::TMatrix22< T >::TMatrix22 | ( | const TMatrix22< T > & | m | ) |
Copy constructor.
|
noexcept |
Move constructor.
sf::TMatrix22< T >::TMatrix22 | ( | std::initializer_list< T > | list | ) |
Initializer list constructor.
sf::TMatrix22< T >::TMatrix22 | ( | T | m00, |
T | m01, | ||
T | m10, | ||
T | m11 | ||
) |
Initializing constructor.
sf::TMatrix22< T >::TMatrix22 | ( | T | scale_x, |
T | scale_y | ||
) |
Scaling constructor.
|
explicit |
Constructs a rotation matrix passing a single angle.
angle | angle of rotation. |
TMatrix22 & sf::TMatrix22< T >::assign | ( | const T | [2][2] | ) |
Assignment using a 2 by 2 array.
TMatrix22 & sf::TMatrix22< T >::assign | ( | value_type | m00, |
value_type | m01, | ||
value_type | m10, | ||
value_type | m11 | ||
) |
Assignment using 4 separate values.
void sf::TMatrix22< T >::copyTo | ( | T | [2][2] | ) | const |
Copy to matrix to 2 by 2 value_type array.
TMatrix22 & sf::TMatrix22< T >::fromString | ( | const std::string & | s | ) |
Gets matrix values from the string representation formed like '({1.2,4.5},{5.6,7.8})'. Throws an exception when the string is not in the correct format.
std::invalid_argument |
T sf::TMatrix22< T >::getRotation | ( | ) | const |
Gets the rotation of the matrix when it is a square matrix.
bool sf::TMatrix22< T >::isEqual | ( | const TMatrix22< T > & | m, |
T | tol = tolerance |
||
) | const |
Compares the passed matrix within the set tolerance.
m | Matrix to compare with. |
tol | The tolerance when comparing which has a default. |
|
constexpr |
Const pointer cast operators.
|
constexpr |
Pointer cast operators.
bool sf::TMatrix22< T >::operator!= | ( | const TMatrix22< T > & | ) | const |
Compare unequal operator using the tolerance for comparing.
TVector2D< T > sf::TMatrix22< T >::operator* | ( | const TVector2D< T > & | ) | const |
Vector transformation operator.
TMatrix22 & sf::TMatrix22< T >::operator*= | ( | const TMatrix22< T > & | m | ) |
Vector transformation operator.
TMatrix22 & sf::TMatrix22< T >::operator= | ( | const TMatrix22< T > & | m | ) |
Assignment operator.
|
noexcept |
Assignment move operator.
bool sf::TMatrix22< T >::operator== | ( | const TMatrix22< T > & | ) | const |
Compare equal operator using the tolerance for comparing.
TMatrix22 & sf::TMatrix22< T >::resetOrientation | ( | ) |
Reset the matrix to the so-called 'identity' matrix where a vector is not changed during transformation.
void sf::TMatrix22< T >::setRotation | ( | T | angle | ) |
Sets the rotation for the matrix.
angle | Angle in radians. |
std::string sf::TMatrix22< T >::toString | ( | ) | const |
Gets the string representation of the matrix formed like '((m00,m01),(m10,m11))'.
TVector2D< T > sf::TMatrix22< T >::transformed | ( | const TVector2D< T > & | ) | const |
Vector transformation method.
TMatrix22 sf::TMatrix22< T >::transposed | ( | ) | const |
Gets the transposed version of the matrix. A transposed rotation matrix inverts the rotation.
|
protected |
|
staticconstexpr |
Tolerance for when comparing in the equal operator.
Used as: std::fabs(x1 - x2) < tolerance