#include <vector2d.h>
General 2d Matrix template. The matrix has a dimension of 3×3 and consists of three rows and three columns. The first row is always "1, 0, 0" and not stored in the class, which means that there are 6 actual numbers used. These numbers are grouped into three vectors, one for the remaining numbers in each column. The three vectors are called off, v1 and v2, together these three vectors can be used to represent the coordinate system. A coordinate system consists of two axes, one for each coordinate (X and Y). The system also has a base position, from which the two axes originate. This base position is stored in off, and the two axis vectors are stored in v1 and v2 respectively
Public Types | |
using | ValueType = typename V::ValueType |
using | ValueTypeParam = typename ByValueParam< ValueType >::type |
using | BoolType = typename V::BoolType |
Public Member Functions | |
Mat2 () | |
Mat2 (const V &off_in, const V &v1_in, const V &v2_in) | |
Mat2 (const V &off_in, const SqMat2< V > &mat_in) | |
MAXON_IMPLICIT | Mat2 (const SqMat2< V > &mat_in) |
template<typename V2 > | |
Mat2 (const Mat2< V2 > &m) | |
Mat2 (ENUM_DONT_INITIALIZE v) | |
void | SetIdentity () |
template<typename V2 > | |
Mat2< typename MultiplicativePromotion< V, typename V2::ValueType >::type > | operator* (const Mat2< V2 > &m2) const |
template<typename V2 > | |
Mat2< typename MultiplicativePromotion< V, typename V2::ValueType >::type > | operator* (const SqMat2< V2 > &m2) const |
template<typename T , Int S> | |
Vec2< typename MultiplicativePromotion< ValueType, T >::type, 1 > | operator* (const Vec2< T, S > &v) const |
Mat2 | operator* (ValueTypeParam s) const |
Mat2 | operator/ (ValueTypeParam s) const |
BoolType | operator== (const Mat2 &other) const |
BoolType | operator!= (const Mat2 &other) const |
Mat2 | operator~ () const |
Mat2 | GetNormalized () const |
String | ToString (const FormatStatement *formatStatement) const |
UInt | GetHashCode () const |
Static Public Member Functions | |
static const Mat2 & | NullValue () |
Public Attributes | |
V | off |
SqMat2< V > | sqmat |
Friends | |
Mat2 | operator* (ValueTypeParam s, const Mat2 &m) |
using ValueType = typename V::ValueType |
using ValueTypeParam = typename ByValueParam<ValueType>::type |
using BoolType = typename V::BoolType |
The type returned by comparisons. If the template argument for V is a vector of SIMD components, this will be a SIMD type, too, which contains the per-element results.
Mat2 | ( | ) |
Default constructor, creates an identity matrix.
Mat2 | ( | const V & | off_in, |
const V & | v1_in, | ||
const V & | v2_in | ||
) |
Initializes matrix from individual components.
Initializes matrix from individual components.
MAXON_IMPLICIT Mat2 | ( | const SqMat2< V > & | mat_in | ) |
Initializes matrix from square matrix. The translation part is initialized to zero.
|
explicit |
Skips initialization of matrix (for better speed)
void SetIdentity | ( | ) |
Sets this matrix to an identity matrix.
Mat2<typename MultiplicativePromotion<V, typename V2::ValueType>::type> operator* | ( | const Mat2< V2 > & | m2 | ) | const |
Multiplies two matrices. The rule is m1 AFTER m2 If you transform a point with the result matrix this is identical to first transforming with m2 and then with m1
Mat2<typename MultiplicativePromotion<V, typename V2::ValueType>::type> operator* | ( | const SqMat2< V2 > & | m2 | ) | const |
Multiplies two matrices. The rule is m1 AFTER m2 If you transform a point with the result matrix this is identical to first transforming with m2 and then with m1
Vec2<typename MultiplicativePromotion<ValueType, T>::type, 1> operator* | ( | const Vec2< T, S > & | v | ) | const |
Transforms a point by a matrix.
Mat2 operator* | ( | ValueTypeParam | s | ) | const |
Scales all matrix components by a scalar value.
Mat2 operator/ | ( | ValueTypeParam | s | ) | const |
Divides all matrix components by a scalar value. If s is 0.0 an identity matrix will be returned.
Equality operator.
[in] | other | Comparison matrix. |
Inequality operator.
[in] | other | Comparison matrix. |
Mat2 operator~ | ( | ) | const |
Calculates the inverse matrix If no inverse can be calculated the result is the Identity matrix
Mat2 GetNormalized | ( | ) | const |
Returns this matrix with all axis vectors normalized.
String ToString | ( | const FormatStatement * | formatStatement | ) | const |
Returns a readable string of the content.
[in] | formatStatement | Nullptr or additional formatting instruction. See also format_float. |
UInt GetHashCode | ( | ) | const |
Returns the hash code of the matrix (used for hash maps and comparisons).
|
static |
Returns a null value of the matrix (see nullvalue.h for more details).
|
friend |
Scales all matrix components by a scalar value.
V off |
The translation vector.
SqMat2<V> sqmat |
The 2×2 matrix for rotation, scale and shear.