#include <matrix.h>
General 3×3 matrix template consisting of three column vectors v1, v2, v3.
Public Types | |
using | VectorStrideType = typename V::VectorStrideType |
using | ValueType = typename V::ValueType |
using | ValueTypeParam = typename ByValueParam< ValueType >::type |
using | BoolType = typename V::BoolType |
Public Member Functions | |
SqMat3 () | |
SqMat3 (const V &v1_in, const V &v2_in, const V &v3_in) | |
template<typename V2 > | |
SqMat3 (const SqMat3< V2 > &m) | |
SqMat3 (ENUM_DONT_INITIALIZE v) | |
template<typename V2 > | |
SqMat3 (const SqMat2< V2 > &m) | |
void | SetIdentity () |
V & | operator[] (Int idx) |
const V & | operator[] (Int idx) const |
template<typename V2 > | |
SqMat3< typename MultiplicativePromotion< V, typename V2::ValueType >::type > | operator* (const SqMat3< V2 > &m2) const |
template<typename T , Int S> | |
Vec3< typename MultiplicativePromotion< ValueType, T >::type, 1 > | operator* (const Vec3< T, S > &v) const |
SqMat3 | operator* (ValueTypeParam s) const |
SqMat3 | operator/ (ValueTypeParam s) const |
SqMat3 | operator+ (const SqMat3 &m2) const |
SqMat3 | operator- (const SqMat3 &m2) const |
BoolType | operator== (const SqMat3 &other) const |
BoolType | operator!= (const SqMat3 &other) const |
ValueType | Det () const |
SqMat3 | operator~ () const |
void | Normalize () |
SqMat3 | GetNormalized () const |
SqMat3 | GetTransposed () const |
V | GetScale () const |
SqMat3 | GetTensorMatrix () const |
SqMat3 & | operator*= (const V &v) |
SqMat3 & | operator*= (ValueTypeParam r) |
String | ToString (const FormatStatement *formatStatement) const |
UInt | GetHashCode () const |
Static Public Member Functions | |
static const SqMat3 & | NullValue () |
Public Attributes | |
V | v1 |
V | v2 |
V | v3 |
Friends | |
SqMat3 | operator* (ValueTypeParam s, const SqMat3 &m) |
using VectorStrideType = typename V::VectorStrideType |
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.
SqMat3 | ( | ) |
Default constructor, creates an identity matrix.
SqMat3 | ( | const V & | v1_in, |
const V & | v2_in, | ||
const V & | v3_in | ||
) |
Initializes matrix from individual components.
|
explicit |
Skips initialization of matrix (for better speed)
Initializes matrix from 2d matrix. v3 is assigned Cross(v1, v2).GetNormalized()
void SetIdentity | ( | ) |
Sets this matrix to an identity matrix.
V& operator[] | ( | Int | idx | ) |
Array (subscript) operator for index access to the matrix components.
[in] | idx | Element index (if it's out of bounds you will get an error in debug code only, otherwise it will crash). |
const V& operator[] | ( | Int | idx | ) | const |
Array (subscript) operator for const index access to the matrix components.
[in] | idx | Element index (if it's out of bounds you will get an error in debug code only, otherwise it will crash). |
SqMat3<typename MultiplicativePromotion<V, typename V2::ValueType>::type> operator* | ( | const SqMat3< 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
Vec3<typename MultiplicativePromotion<ValueType, T>::type, 1> operator* | ( | const Vec3< T, S > & | v | ) | const |
Transforms a vector by a matrix.
SqMat3 operator* | ( | ValueTypeParam | s | ) | const |
Scales all matrix components by a scalar value.
SqMat3 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. |
ValueType Det | ( | ) | const |
Computes the determinant of this matrix.
SqMat3 operator~ | ( | ) | const |
Calculates the inverse matrix If no inverse can be calculated the result is the Identity matrix
void Normalize | ( | ) |
Normalizes the length of all three axes.
SqMat3 GetNormalized | ( | ) | const |
Returns this matrix with all axis vectors normalized.
SqMat3 GetTransposed | ( | ) | const |
Returns the transposed matrix.
V GetScale | ( | void | ) | const |
SqMat3 GetTensorMatrix | ( | ) | const |
Calculates the tensor matrix which allows to transform normal vectors for non-orthogonal matrices. The tensor matrix T of a matrix M is given by T = inverse(transpose(M)) * det(M), and its computation is faster than that of the inverse transpose. To transform a normal with a normalized result, use the formula transformedNormal = !(matrix.GetTensorMatrix() * normal).
SqMat3& operator*= | ( | const V & | v | ) |
Scales each axis by the respective components of the passed vector.
SqMat3& operator*= | ( | ValueTypeParam | r | ) |
Scales each axis by the scalar.
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 v1 |
The X axis.
V v2 |
The Y axis.
V v3 |
The Z axis.