xcal
基于 C++23 的现代图形渲染引擎
载入中...
搜索中...
未找到
Public 类型 | Public 成员函数 | 静态 Public 成员函数 | 静态 Public 属性 | 所有成员列表
xcmath::mat< _Tp, _rows, _cols > 模板类 参考

Matrix class template 更多...

#include <mat.hpp>

类 xcmath::mat< _Tp, _rows, _cols > 继承关系图:
[图例]
xcmath::mat< _Tp, _rows, _cols > 的协作图:
[图例]

Public 类型

template<class _T >
using Self = mat< _T, _rows, _cols >
 Alias for the matrix type with a different element type
 
- Public 类型 继承自 xcmath::vec< _Tp, _length >
using ItemType = _Tp
 Type of elements in the vector
 
using DataType = typename VecInfo< ItemType >::DataType
 Type of data stored in the vector
 
template<size_t __len, size_t... __lens>
using SubVec = __subVecHelper< size_t, __len, __lens... >::Type
 
template<class _T >
using Self = vec< _T, _length >
 

Public 成员函数

 mat (const vec< vec< _Tp, _cols >, _rows > &o)
 
template<size_t _ncols>
constexpr mat< _Tp, _rows, _ncols > operator^ (const mat< _Tp, _cols, _ncols > &other) const
 Matrix multiplication operator
 
template<Vec _VTp>
requires (_VTp::length == _rows) && concepts::Add<typename _VTp::DataType> && concepts::Muitiply<typename _VTp::DataType, _Tp>
constexpr _VTp operator^ (const _VTp &other) const
 Matrix-vector multiplication operator
 
constexpr mat< _Tp, _cols, _rows > T () const
 Transpose operator
 
constexpr mat< _Tp, _cols, _rows > inv () const
 
constexpr _Tp det () const
 Compute determinant of the matrix
 
- Public 成员函数 继承自 xcmath::vec< _Tp, _length >
constexpr vec ()
 Construct a zero-initialized vector Notw: _Tp must be default constructible
 
template<class _Tp1 , class... _T>
requires (std::is_convertible_v<_Tp1, _Tp> && (std::is_convertible_v<_T, _Tp> && ...))
constexpr vec (const _Tp1 &arg1, const _T &... args)
 Construct from component values
 
template<typename... _Args>
requires ((VecConstructPackSize<_Args...> <= _length && VecConstructPackSize<_Args...> > 1) && ((VecItem<_Args, ItemType> || std::is_convertible_v<_Args, ItemType>) && ...))
constexpr vec (const _Args &... args)
 Construct from mixed scalars and vectors
 
template<class T >
requires (std::is_convertible_v<T, ItemType>)
constexpr vec (const T &fill_value)
 Uniform value constructor
 
constexpr vec (const vec< _Tp, _length > &other)
 Copy constructor
 
constexpr vec (vec< _Tp, _length > &&o)
 Move constructor
 
constexpr vec (const std::initializer_list< ItemType > &list)
 
constexpr const _Tp * begin () const
 Get pointer to the beginning of the data array
 
constexpr const _Tp * end () const
 Get pointer to the end of the data array
 
constexpr _Tp & operator[] (size_t index)
 Access element at specified index
 
constexpr const _Tp & operator[] (size_t index) const
 Access element at specified index (const version)
 
constexpr vec< _Tp, _length > & operator= (const vec< _Tp, _length > &o)
 Copy assignment operator
 
constexpr vec< _Tp, _length > & operator= (vec< _Tp, _length > &&o)
 Move assignment operator
 
template<size_t... idx, class... _Ss>
requires (sizeof...(_Ss) < dim)
constexpr SubVec< sizeof...(idx),(_Ss::length,...)> operator() (Slice< idx... >, _Ss... ns) const
 qualified operator() for slicing and swizzling
 
template<size_t... idx>
constexpr vec< ItemType, sizeof...(idx)> operator() (Slice< idx... > s) const
 qualified operator() for slicing and swizzling (const version)
 
constexpr _Tp & x ()
 Get the item at index 0
 
constexpr _Tp & y ()
 Get the item at index 1
 
constexpr _Tp & z ()
 Get the item at index 2
 
constexpr _Tp & w ()
 Get the item at index 3
 
constexpr const _Tp & x () const
 Get the item at index 0 (const version)
 
constexpr const _Tp & y () const
 Get the item at index 1 (const version)
 
constexpr const _Tp & z () const
 Get the item at index 2 (const version)
 
constexpr const _Tp & w () const
 Get the item at index 3 (const version)
 
constexpr const vec< _Tp, 2 > & xy () const
 
constexpr vec< _Tp, 2 > & xy ()
 
constexpr const vec< _Tp, 2 > & yz () const
 
constexpr vec< _Tp, 2 > & yz ()
 
constexpr const vec< _Tp, 2 > & zw () const
 
constexpr vec< _Tp, 2 > & zw ()
 
constexpr const vec< _Tp, 3 > & xyz () const
 
constexpr vec< _Tp, 3 > & xyz ()
 
constexpr const vec< _Tp, 3 > & yzw () const
 
constexpr vec< _Tp, 3 > & yzw ()
 
constexpr vec< _Tp, 2 > xz () const
 
constexpr vec< _Tp, 2 > xw () const
 
constexpr vec< _Tp, 2 > yw () const
 
constexpr vec< _Tp, _length > cross (const vec< _Tp, _length > &other) const
 Compute 3D cross product
 
constexpr _Tp dot (const vec< _Tp, _length > &other) const
 Compute Euclidean inner product
 
constexpr vec< _Tp, _length > normalize () const
 Create unit vector in same direction
 
constexpr _Tp distance (const vec< _Tp, _length > &other) const
 Compute distance to another vector
 
constexpr _Tp mod () const
 Calculate Euclidean norm (magnitude)
 
constexpr _Tp angle (const vec< _Tp, _length > &other) const
 Compute angle with another vector
 
constexpr bool any () const
 Check if any element satisfies a condition
 
constexpr bool every () const
 Check if all elements satisfy a condition
 
constexpr bool all () const
 Check universal quantification of components
 
template<typename _OTp >
requires (std::is_convertible_v<ItemType, _OTp>)
constexpr operator Self< _OTp > () const
 
auto operator- () const
 Component-wise additive inverse
 
auto operator+ () const
 Unary plus operator
 
auto operator-- ()
 Pre-decrement operator
 
auto & operator-- (int)
 Post-decrement operator
 
auto operator++ ()
 Pre-increment operator
 
auto & operator++ (int)
 Post-increment operator
 

静态 Public 成员函数

static constexpr mat< _Tp, _rows, _cols > ones ()
 Create a matrix filled with ones
 
static constexpr mat< _Tp, _rows, _cols > eye ()
 Create an identity matrix
 

静态 Public 属性

static constexpr vec2< size_t > shape {_rows, _cols}
 Shape of the matrix (rows x columns)
 
- 静态 Public 属性 继承自 xcmath::vec< _Tp, _length >
static constexpr size_t dim = VecInfo<ItemType>::dim + 1
 
static constexpr auto datatype = TypeName<DataType>
 Name of the data type
 
static constexpr auto itemtype = TypeName<ItemType>
 Name of the item type
 
static constexpr auto length = _length
 Length of the vector
 

额外继承的成员函数

- Protected 属性 继承自 xcmath::vec< _Tp, _length >
_Tp data [_length]
 Component storage array
 

详细描述

template<typename _Tp, size_t _rows, size_t _cols = _rows>
class xcmath::mat< _Tp, _rows, _cols >

Matrix class template

模板参数
_TpType of elements in the matrix
_rowsNumber of rows
_colsNumber of columns
_TpType of elements in the matrix
_rowsNumber of rows
_colsNumber of columns (defaults to _rows for square matrices)

在文件 mat.hpp27 行定义.

成员类型定义说明

◆ Self

template<typename _Tp , size_t _rows, size_t _cols = _rows>
template<class _T >
using xcmath::mat< _Tp, _rows, _cols >::Self = mat<_T, _rows, _cols>

Alias for the matrix type with a different element type

模板参数
_TType of elements for the new matrix

在文件 mat.hpp65 行定义.

构造及析构函数说明

◆ mat()

template<typename _Tp , size_t _rows, size_t _cols = _rows>
xcmath::mat< _Tp, _rows, _cols >::mat ( const vec< vec< _Tp, _cols >, _rows > &  o)
inline

在文件 mat.hpp32 行定义.

成员函数说明

◆ det()

template<typename _Tp , size_t _rows, size_t _cols = _rows>
constexpr _Tp xcmath::mat< _Tp, _rows, _cols >::det ( ) const
inlineconstexpr

Compute determinant of the matrix

返回
Determinant value of type _Tp

在文件 mat.hpp182 行定义.

引用了 xcmath::vec< _Tp, _length >::data , 以及 xcmath::mat< _Tp, _rows, _cols >::det().

被这些函数引用 xcmath::mat< _Tp, _rows, _cols >::det(), xcmath::mat< _Tp, _rows, _cols >::inv(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST() , 以及 TEST().

◆ eye()

template<typename _Tp , size_t _rows, size_t _cols = _rows>
static constexpr mat< _Tp, _rows, _cols > xcmath::mat< _Tp, _rows, _cols >::eye ( )
inlinestaticconstexpr

Create an identity matrix

返回
Identity matrix of type mat<_Tp, _rows, _cols>

在文件 mat.hpp168 行定义.

被这些函数引用 xcmath::rotate(), xcmath::rotate(), xcmath::scale(), TEST(), TEST(), TEST(), TEST(), TEST() , 以及 TEST().

◆ inv()

template<typename _Tp , size_t _rows, size_t _cols = _rows>
constexpr mat< _Tp, _cols, _rows > xcmath::mat< _Tp, _rows, _cols >::inv ( ) const
inlineconstexpr

在文件 mat.hpp127 行定义.

引用了 xcmath::vec< _Tp, _length >::data , 以及 xcmath::mat< _Tp, _rows, _cols >::det().

被这些函数引用 TEST() , 以及 TEST().

◆ ones()

template<typename _Tp , size_t _rows, size_t _cols = _rows>
static constexpr mat< _Tp, _rows, _cols > xcmath::mat< _Tp, _rows, _cols >::ones ( )
inlinestaticconstexpr

Create a matrix filled with ones

返回
Matrix of type mat<_Tp, _rows, _cols> filled with ones

在文件 mat.hpp159 行定义.

被这些函数引用 TEST(), TEST() , 以及 TEST().

◆ operator^() [1/2]

template<typename _Tp , size_t _rows, size_t _cols = _rows>
template<Vec _VTp>
requires (_VTp::length == _rows) && concepts::Add<typename _VTp::DataType> && concepts::Muitiply<typename _VTp::DataType, _Tp>
constexpr _VTp xcmath::mat< _Tp, _rows, _cols >::operator^ ( const _VTp &  other) const
inlineconstexpr

Matrix-vector multiplication operator

模板参数
_VTpVector type
参数
otherVector to multiply with
返回
Resulting vector of type _VTp

在文件 mat.hpp102 行定义.

引用了 xcmath::vec< _Tp, _length >::data.

◆ operator^() [2/2]

template<typename _Tp , size_t _rows, size_t _cols = _rows>
template<size_t _ncols>
constexpr mat< _Tp, _rows, _ncols > xcmath::mat< _Tp, _rows, _cols >::operator^ ( const mat< _Tp, _cols, _ncols > &  other) const
inlineconstexpr

Matrix multiplication operator

模板参数
_ncolsNumber of columns in the right matrix
参数
otherRight matrix to multiply with
返回
Resulting matrix of type mat<_Tp, _rows, _ncols>

在文件 mat.hpp78 行定义.

引用了 xcmath::vec< _Tp, _length >::data.

◆ T()

template<typename _Tp , size_t _rows, size_t _cols = _rows>
constexpr mat< _Tp, _cols, _rows > xcmath::mat< _Tp, _rows, _cols >::T ( ) const
inlineconstexpr

Transpose operator

返回
Transposed matrix of type mat<_Tp, _cols, _rows>

在文件 mat.hpp117 行定义.

引用了 xcmath::vec< _Tp, _length >::data.

类成员变量说明

◆ shape

template<typename _Tp , size_t _rows, size_t _cols = _rows>
constexpr vec2<size_t> xcmath::mat< _Tp, _rows, _cols >::shape {_rows, _cols}
staticconstexpr

Shape of the matrix (rows x columns)

在文件 mat.hpp32 行定义.


该类的文档由以下文件生成: