SqrMat2< V > Struct Template Reference

#include <matrix2d.h>

详细描述

template<typename V>
struct maxon::SqrMat2< V >

General 2×2 matrix template consisting of two column vectors v1, v2.

Public Types

using  VectorStrideType = typename V::VectorStrideType
using  ValueType = typename V::ValueType
using  ValueTypeParam = typename ByValueParam < ValueType >::type
using  BoolType = typename V::BoolType

公共成员函数

constexpr  SqrMat2 ()
constexpr  SqrMat2 (const V &v1_in, const V &v2_in)
template<typename V2 >
constexpr  SqrMat2 (const SqrMat2 < V2 > &m)
constexpr  SqrMat2 ( ENUM_DONT_INITIALIZE v)
constexpr void  SetIdentity ()
V &  operator[] ( Int idx)
const V &  operator[] ( Int idx) const
template<typename V2 >
constexpr SqrMat2 < typename MultiplicativePromotion < V, typename V2::ValueType >::type >  operator* (const SqrMat2 < V2 > &m2) const
template<typename T , Int S>
constexpr Vec2 < typename MultiplicativePromotion < ValueType , T >::type, 1 >  operator* (const Vec2 < T, S > &v) const
constexpr SqrMat2   operator* ( ValueTypeParam s) const
constexpr SqrMat2   operator/ ( ValueTypeParam s) const
constexpr SqrMat2   operator+ (const SqrMat2 &m2) const
constexpr SqrMat2   operator- (const SqrMat2 &m2) const
constexpr BoolType   operator== (const SqrMat2 &other) const
constexpr BoolType   operator!= (const SqrMat2 &other) const
constexpr ValueType   Det () const
constexpr SqrMat2   operator~ () const
constexpr void  Normalize ()
constexpr SqrMat2   GetNormalized () const
constexpr SqrMat2 operator*= (const V &v)
constexpr SqrMat2 operator*= ( ValueTypeParam r)
String   ToString (const FormatStatement *formatStatement=nullptr) const
constexpr HashInt   GetHashCode () const

静态公共成员函数

static constexpr const SqrMat2 NullValue ()

Public Attributes

v1
v2

Friends

constexpr friend SqrMat2   operator* ( ValueTypeParam s, const SqrMat2 &m)

Member Typedef Documentation

◆  VectorStrideType

using VectorStrideType = typename V::VectorStrideType

◆  ValueType

using ValueType = typename V::ValueType

◆  ValueTypeParam

using ValueTypeParam = typename ByValueParam < ValueType >::type

◆  BoolType

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.

构造函数 & 析构函数文档编制

◆  SqrMat2() [1/4]

constexpr SqrMat2 ( )
constexpr

Default constructor, creates an identity matrix.

◆  SqrMat2() [2/4]

constexpr SqrMat2 ( const V &  v1_in ,
const V &  v2_in  
)
constexpr

Initializes matrix from individual components.

◆  SqrMat2() [3/4]

constexpr SqrMat2 ( const SqrMat2 < V2 > &  m )
explicit constexpr

Initializes matrix from another matrix.

◆  SqrMat2() [4/4]

constexpr SqrMat2 ( ENUM_DONT_INITIALIZE   v )
explicit constexpr

Skips initialization of matrix (for better speed)

成员函数文档编制

◆  SetIdentity()

constexpr void SetIdentity ( )
constexpr

Sets this matrix to an identity matrix.

◆  operator[]() [1/2]

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).
返回
Matrix component.

◆  operator[]() [2/2]

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).
返回
Matrix component.

◆  operator*() [1/3]

constexpr SqrMat2 <typename MultiplicativePromotion <V, typename V2::ValueType>::type> operator* ( const SqrMat2 < V2 > &  m2 ) const
constexpr

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

◆  operator*() [2/3]

constexpr Vec2 <typename MultiplicativePromotion < ValueType , T>::type, 1> operator* ( const Vec2 < T, S > &  v ) const
constexpr

Transforms a point by a matrix.

◆  operator*() [3/3]

constexpr SqrMat2 operator* ( ValueTypeParam   s ) const
constexpr

Scales all matrix components by a scalar value.

◆  operator/()

constexpr SqrMat2 operator/ ( ValueTypeParam   s ) const
constexpr

Divides all matrix components by a scalar value. If s is 0.0 an identity matrix will be returned.

◆  operator+()

constexpr SqrMat2 operator+ ( const SqrMat2 < V > &  m2 ) const
constexpr

Adds two matrices component-wise.

◆  operator-()

constexpr SqrMat2 operator- ( const SqrMat2 < V > &  m2 ) const
constexpr

Subtracts two matrices component-wise.

◆  operator==()

constexpr BoolType operator== ( const SqrMat2 < V > &  other ) const
constexpr

Equality operator.

参数
[in] other Comparison matrix.
返回
True if this and other are equal, otherwise false.

◆  operator!=()

constexpr BoolType operator!= ( const SqrMat2 < V > &  other ) const
constexpr

Inequality operator.

参数
[in] other Comparison matrix.
返回
False if this and other are equal, otherwise true.

◆  Det()

constexpr ValueType Det ( ) const
constexpr

Computes the determinant of this matrix.

◆  operator~()

constexpr SqrMat2 operator~ ( ) const
constexpr

Calculates the inverse matrix If no inverse can be calculated the result is the Identity matrix

◆  Normalize()

constexpr void Normalize ( )
constexpr

Normalizes the length of all three axes.

◆  GetNormalized()

constexpr SqrMat2 GetNormalized ( ) const
constexpr

Returns this matrix with all axis vectors normalized.

◆  operator*=() [1/2]

constexpr SqrMat2 & operator*= ( const V &  v )
constexpr

Scales each axis by the respective components of the passed vector.

◆  operator*=() [2/2]

constexpr SqrMat2 & operator*= ( ValueTypeParam   r )
constexpr

Scales each axis by the scalar.

◆  ToString()

String ToString ( const FormatStatement formatStatement = nullptr ) const

Returns a readable string of the content.

参数
[in] formatStatement Nullptr or additional formatting instruction. See also Formatting Floating point values .
返回
The converted result.

◆  GetHashCode()

constexpr HashInt GetHashCode ( ) const
constexpr

Returns the hash code of the matrix (used for hash maps and comparisons).

返回
The matrix' hash code.

◆  NullValue()

static constexpr const SqrMat2 & NullValue ( )
static constexpr

Returns a null value of the matrix (see nullvalue.h for more details).

返回
A null value of the matrix.

Friends And Related Function Documentation

◆  operator*

constexpr friend SqrMat2 operator* ( ValueTypeParam   s ,
const SqrMat2 < V > &  m  
)
friend

Scales all matrix components by a scalar value.

Member Data Documentation

◆  v1

V v1

The X axis.

◆  v2

V v2

The Y axis.