akreon-linalg
Fixed-size linear algebra and numerical methods in C++26.
Loading...
Searching...
No Matches
affine::AffineMap< Mat > Class Template Reference

AffineMap class definition. More...

#include <affine_map.hpp>

Public Types

using T = linalg::matrix_scalar_t< Mat >
 alias to extract underlying type of affine set
 
using DomVec = linalg::Vector< T, N >
 alias for underlying vector spanning R^n (domain)
 
using AmbientVec = linalg::Vector< T, M >
 alias for underlying vector spanning R^m (codomain)
 

Public Member Functions

constexpr AffineMap ()
 CTOR.
 
constexpr AffineMap (const Mat &U_in)
 CTOR.
 
constexpr AffineMap (const Mat &U_in, const AmbientVec &c_in)
 CTOR.
 
constexpr AffineMap (const linalg::Matrix< T, M+1, N+1 > &H)
 CTOR.
 
template<linalg::MatrixContainer OtherMat>
requires (std::same_as<T, linalg::matrix_scalar_t<OtherMat>> && linalg::mat_rows_v<OtherMat> == N)
constexpr auto compose (const AffineMap< OtherMat > &other) const
 compose function
 
constexpr auto inverse () const
 inverse mapping
 
constexpr auto linear_part () const
 linear part
 
constexpr auto translation () const
 translation
 
constexpr bool operator== (const AffineMap< Mat > &other) const
 equality comparison overload
 
constexpr bool operator!= (const AffineMap< Mat > &other) const
 inequality comparison overload
 
constexpr auto operator() (const DomVec &x) const
 transform point to coords
 

Static Public Attributes

static constexpr std::size_t M = linalg::mat_rows_v<Mat>
 helpers to extracting M x N matrix
 
static constexpr std::size_t N = linalg::mat_cols_v<Mat>
 

Detailed Description

template<linalg::MatrixContainer Mat>
class affine::AffineMap< Mat >

AffineMap class definition.

forward declaration of affine map

Valid mapping which transforms one affine set to another.

f(x) = U x + c

Applies linear transform via U and then translation by vector c

Definition at line 63 of file affine_map.hpp.

Member Typedef Documentation

◆ AmbientVec

template<linalg::MatrixContainer Mat>
using affine::AffineMap< Mat >::AmbientVec = linalg::Vector<T, M>

alias for underlying vector spanning R^m (codomain)

Definition at line 76 of file affine_map.hpp.

◆ DomVec

template<linalg::MatrixContainer Mat>
using affine::AffineMap< Mat >::DomVec = linalg::Vector<T, N>

alias for underlying vector spanning R^n (domain)

Definition at line 73 of file affine_map.hpp.

◆ T

alias to extract underlying type of affine set

Definition at line 66 of file affine_map.hpp.

Constructor & Destructor Documentation

◆ AffineMap() [1/4]

template<linalg::MatrixContainer Mat>
constexpr affine::AffineMap< Mat >::AffineMap ( )
inlineexplicitconstexpr

CTOR.

empty map

Definition at line 83 of file affine_map.hpp.

Referenced by affine::AffineMap< Mat >::inverse().

◆ AffineMap() [2/4]

template<linalg::MatrixContainer Mat>
constexpr affine::AffineMap< Mat >::AffineMap ( const Mat &  U_in)
inlineexplicitconstexpr

CTOR.

Parameters
matrixM x N

Definition at line 90 of file affine_map.hpp.

◆ AffineMap() [3/4]

template<linalg::MatrixContainer Mat>
constexpr affine::AffineMap< Mat >::AffineMap ( const Mat &  U_in,
const AmbientVec &  c_in 
)
inlineexplicitconstexpr

CTOR.

Parameters
matrixof type T M x N elements
vectorof type T M elements

Definition at line 98 of file affine_map.hpp.

◆ AffineMap() [4/4]

template<linalg::MatrixContainer Mat>
constexpr affine::AffineMap< Mat >::AffineMap ( const linalg::Matrix< T, M+1, N+1 > &  H)
inlineexplicitconstexpr

CTOR.

Parameters
matrixof type T (M + 1) x (N + 1) elements

Definition at line 106 of file affine_map.hpp.

Member Function Documentation

◆ compose()

template<linalg::MatrixContainer Mat>
template<linalg::MatrixContainer OtherMat>
requires (std::same_as<T, linalg::matrix_scalar_t<OtherMat>> && linalg::mat_rows_v<OtherMat> == N)
constexpr auto affine::AffineMap< Mat >::compose ( const AffineMap< OtherMat > &  other) const
inlineconstexpr

compose function

Compose a sequence of affine maps as such: f circ g = f(g(x))

g(x) = A_g x + b_g f(x) = A_f x + b_f f(g(x)) = A_f (A_g x + b_g) + b_f = (A_f A_g) x + (A_f b_g + b_f)

Parameters
validreference to an affine map object
Returns
new affine map object with the new applied mapping

Definition at line 127 of file affine_map.hpp.

References affine::AffineMap< Mat >::linear_part(), linalg::mat_rows_v, and affine::AffineMap< Mat >::translation().

◆ inverse()

template<linalg::MatrixContainer Mat>
constexpr auto affine::AffineMap< Mat >::inverse ( ) const
inlineconstexpr

inverse mapping

Apply the inverse of the linear transformation matrix U and back out the translation by the inverse.

f(x) = U x + c f^{-1}(f(x)) = id or x

f^{-1}(x) = U^{-1} x - U^{-1} c f^{-1}(f(x)) = U^{-1}(U x + c) - U^{-1} c == x

Returns
new affine map object that is the inverse of the forward mapping

Definition at line 148 of file affine_map.hpp.

References affine::AffineMap< Mat >::AffineMap(), affine::AffineMap< Mat >::M, linalg::mat_rows_v, and affine::AffineMap< Mat >::N.

◆ linear_part()

template<linalg::MatrixContainer Mat>
constexpr auto affine::AffineMap< Mat >::linear_part ( ) const
inlineconstexpr

linear part

Returns
U

Definition at line 160 of file affine_map.hpp.

Referenced by affine::AffineMap< Mat >::compose().

◆ operator!=()

template<linalg::MatrixContainer Mat>
constexpr bool affine::AffineMap< Mat >::operator!= ( const AffineMap< Mat > &  other) const
inlineconstexpr

inequality comparison overload

Parameters
affineset
Returns
T/F

Definition at line 187 of file affine_map.hpp.

◆ operator()()

template<linalg::MatrixContainer Mat>
constexpr auto affine::AffineMap< Mat >::operator() ( const DomVec &  x) const
inlineconstexpr

transform point to coords

Parameters
pointin R^n
Returns
transformed point

Definition at line 198 of file affine_map.hpp.

◆ operator==()

template<linalg::MatrixContainer Mat>
constexpr bool affine::AffineMap< Mat >::operator== ( const AffineMap< Mat > &  other) const
inlineconstexpr

equality comparison overload

Parameters
affineset
Returns
T/F

Definition at line 176 of file affine_map.hpp.

◆ translation()

template<linalg::MatrixContainer Mat>
constexpr auto affine::AffineMap< Mat >::translation ( ) const
inlineconstexpr

translation

Returns
c

Definition at line 167 of file affine_map.hpp.

Referenced by affine::AffineMap< Mat >::compose().

Member Data Documentation

◆ M

template<linalg::MatrixContainer Mat>
constexpr std::size_t affine::AffineMap< Mat >::M = linalg::mat_rows_v<Mat>
staticconstexpr

helpers to extracting M x N matrix

Definition at line 69 of file affine_map.hpp.

Referenced by affine::AffineMap< Mat >::inverse().

◆ N

template<linalg::MatrixContainer Mat>
constexpr std::size_t affine::AffineMap< Mat >::N = linalg::mat_cols_v<Mat>
staticconstexpr

Definition at line 70 of file affine_map.hpp.

Referenced by affine::AffineMap< Mat >::inverse().


The documentation for this class was generated from the following file: