Fx2D
A C++20 2D rigid-body physics engine
Loading...
Searching...
No Matches
FxArray< T > Class Template Reference

Fixed-size, aligned value array. More...

#include <Math.h>

Public Member Functions

 FxArray ()
 
 FxArray (std::size_t n)
 
 FxArray (std::initializer_list< T > init)
 
 FxArray (std::vector< T > const &v)
 
template<std::size_t N>
 FxArray (T const (&arr)[N])
 
 FxArray (FxArray const &o)
 
 FxArray (FxArray &&) noexcept=default
 
 ~FxArray ()=default
 
FxArray & operator= (FxArray const &o)
 
FxArray & operator= (std::vector< T > const &v)
 
FxArray & operator= (std::initializer_list< T > init)
 
FxArray & operator= (FxArray &&) noexcept=default
 
T * aligned_data () noexcept
 
T const * aligned_data () const noexcept
 
T & operator[] (size_t i) noexcept
 
T const & operator[] (size_t i) const noexcept
 
template<std::integral I>
T & operator() (I i) noexcept
 
template<std::integral I>
T const & operator() (I i) const noexcept
 
template<std::integral I>
T & at (I idx)
 
template<std::integral I>
T const & at (I idx) const
 
T * begin () noexcept
 
T const * begin () const noexcept
 
T * end () noexcept
 
T const * end () const noexcept
 
size_t size () const noexcept
 
bool empty () const noexcept
 
T * data () noexcept
 
T const * data () const noexcept
 
void swap (FxArray &o) noexcept
 
template<typename U >
requires (Numeric<T> && Numeric<U>)
FxArray< U > as () const
 
template<typename Compare >
T min (Compare cmp) const
 
template<typename Compare >
T max (Compare cmp) const
 
T min () const
 
T max () const
 
template<typename Compare >
std::pair< std::size_t, T > argmin (Compare cmp) const
 
template<typename Compare >
std::pair< std::size_t, T > argmax (Compare cmp) const
 
std::pair< std::size_t, T > argmin () const
 
std::pair< std::size_t, T > argmax () const
 
T mean () const
 
float meanf () const
 
float stddev () const
 
FxArray operator- () const
 
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & operator+= (U const &v)
 
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & operator-= (U const &v)
 
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & operator*= (U const &v)
 
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & operator/= (U const &v)
 
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & operator+= (FxArray< U > const &o)
 
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & operator-= (FxArray< U > const &o)
 
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & operator*= (FxArray< U > const &o)
 
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & operator/= (FxArray< U > const &o)
 
FxArray< float > dot (T const &v) const
 
FxArray< float > dot (FxArray< T > const &o) const
 
FxArray & rotate_inplace_rad (float theta_rad) noexcept
 
FxArray & rotate_inplace (float degrees) noexcept
 
FxArray & perp_inplace () noexcept
 
FxArray perp () const
 
FxArray rotate_rad (float theta_rad) const
 
FxArray rotate (float degrees) const
 
FxArray< float > bounds () const
 

Protected Member Functions

template<std::integral I>
std::size_t checkIndex (I idx) const
 
void throw_if_empty (char const *what) const
 
void throw_if_size_mismatch (char const *what, size_t o_size) const
 
template<typename Compare >
std::pair< std::size_t, T > best_pair (Compare cmp, const char *name) const
 

Detailed Description

template<NumericOrFxVec T>
class FxArray< T >

Fixed-size, aligned value array.

Definition at line 694 of file Math.h.

Constructor & Destructor Documentation

◆ FxArray() [1/7]

template<NumericOrFxVec T>
FxArray< T >::FxArray ( )
inline

Definition at line 743 of file Math.h.

◆ FxArray() [2/7]

template<NumericOrFxVec T>
FxArray< T >::FxArray ( std::size_t  n)
inlineexplicit

Definition at line 745 of file Math.h.

◆ FxArray() [3/7]

template<NumericOrFxVec T>
FxArray< T >::FxArray ( std::initializer_list< T >  init)
inline

Definition at line 748 of file Math.h.

◆ FxArray() [4/7]

template<NumericOrFxVec T>
FxArray< T >::FxArray ( std::vector< T > const &  v)
inline

Definition at line 753 of file Math.h.

◆ FxArray() [5/7]

template<NumericOrFxVec T>
template<std::size_t N>
FxArray< T >::FxArray ( T const (&)  arr[N])
inline

Definition at line 759 of file Math.h.

◆ FxArray() [6/7]

template<NumericOrFxVec T>
FxArray< T >::FxArray ( FxArray< T > const &  o)
inline

Definition at line 764 of file Math.h.

◆ FxArray() [7/7]

template<NumericOrFxVec T>
FxArray< T >::FxArray ( FxArray< T > &&  )
defaultnoexcept

◆ ~FxArray()

template<NumericOrFxVec T>
FxArray< T >::~FxArray ( )
default

Member Function Documentation

◆ aligned_data() [1/2]

template<NumericOrFxVec T>
T const * FxArray< T >::aligned_data ( ) const
inlinenoexcept

Definition at line 801 of file Math.h.

◆ aligned_data() [2/2]

template<NumericOrFxVec T>
T * FxArray< T >::aligned_data ( )
inlinenoexcept

Definition at line 800 of file Math.h.

◆ argmax() [1/2]

template<NumericOrFxVec T>
std::pair< std::size_t, T > FxArray< T >::argmax ( ) const
inline

Definition at line 882 of file Math.h.

◆ argmax() [2/2]

template<NumericOrFxVec T>
template<typename Compare >
std::pair< std::size_t, T > FxArray< T >::argmax ( Compare  cmp) const
inline

Definition at line 876 of file Math.h.

◆ argmin() [1/2]

template<NumericOrFxVec T>
std::pair< std::size_t, T > FxArray< T >::argmin ( ) const
inline

Definition at line 881 of file Math.h.

◆ argmin() [2/2]

template<NumericOrFxVec T>
template<typename Compare >
std::pair< std::size_t, T > FxArray< T >::argmin ( Compare  cmp) const
inline

Definition at line 871 of file Math.h.

◆ as()

template<NumericOrFxVec T>
template<typename U >
requires (Numeric<T> && Numeric<U>)
FxArray< U > FxArray< T >::as ( ) const
inline

Definition at line 846 of file Math.h.

◆ at() [1/2]

template<NumericOrFxVec T>
template<std::integral I>
T & FxArray< T >::at ( I  idx)
inline

Definition at line 819 of file Math.h.

◆ at() [2/2]

template<NumericOrFxVec T>
template<std::integral I>
T const & FxArray< T >::at ( I  idx) const
inline

Definition at line 823 of file Math.h.

◆ begin() [1/2]

template<NumericOrFxVec T>
T const * FxArray< T >::begin ( ) const
inlinenoexcept

Definition at line 829 of file Math.h.

◆ begin() [2/2]

template<NumericOrFxVec T>
T * FxArray< T >::begin ( )
inlinenoexcept

Definition at line 828 of file Math.h.

◆ best_pair()

template<NumericOrFxVec T>
template<typename Compare >
std::pair< std::size_t, T > FxArray< T >::best_pair ( Compare  cmp,
const char *  name 
) const
inlineprotected

Definition at line 727 of file Math.h.

◆ bounds()

template<NumericOrFxVec T>
FxArray< float > FxArray< T >::bounds ( ) const
inline

Definition at line 1103 of file Math.h.

◆ checkIndex()

template<NumericOrFxVec T>
template<std::integral I>
std::size_t FxArray< T >::checkIndex ( I  idx) const
inlineprotected

Definition at line 703 of file Math.h.

◆ data() [1/2]

template<NumericOrFxVec T>
T const * FxArray< T >::data ( ) const
inlinenoexcept

Definition at line 837 of file Math.h.

◆ data() [2/2]

template<NumericOrFxVec T>
T * FxArray< T >::data ( )
inlinenoexcept

Definition at line 836 of file Math.h.

◆ dot() [1/2]

template<NumericOrFxVec T>
FxArray< float > FxArray< T >::dot ( FxArray< T > const &  o) const
inline

Definition at line 1030 of file Math.h.

◆ dot() [2/2]

template<NumericOrFxVec T>
FxArray< float > FxArray< T >::dot ( T const &  v) const
inline

Definition at line 1018 of file Math.h.

◆ empty()

template<NumericOrFxVec T>
bool FxArray< T >::empty ( ) const
inlinenoexcept

Definition at line 835 of file Math.h.

◆ end() [1/2]

template<NumericOrFxVec T>
T const * FxArray< T >::end ( ) const
inlinenoexcept

Definition at line 831 of file Math.h.

◆ end() [2/2]

template<NumericOrFxVec T>
T * FxArray< T >::end ( )
inlinenoexcept

Definition at line 830 of file Math.h.

◆ max() [1/2]

template<NumericOrFxVec T>
T FxArray< T >::max ( ) const
inline

Definition at line 867 of file Math.h.

◆ max() [2/2]

template<NumericOrFxVec T>
template<typename Compare >
T FxArray< T >::max ( Compare  cmp) const
inline

Definition at line 861 of file Math.h.

◆ mean()

template<NumericOrFxVec T>
T FxArray< T >::mean ( ) const
inline

Definition at line 885 of file Math.h.

◆ meanf()

template<NumericOrFxVec T>
float FxArray< T >::meanf ( ) const
inline

Definition at line 895 of file Math.h.

◆ min() [1/2]

template<NumericOrFxVec T>
T FxArray< T >::min ( ) const
inline

Definition at line 866 of file Math.h.

◆ min() [2/2]

template<NumericOrFxVec T>
template<typename Compare >
T FxArray< T >::min ( Compare  cmp) const
inline

Definition at line 856 of file Math.h.

◆ operator()() [1/2]

template<NumericOrFxVec T>
template<std::integral I>
T const & FxArray< T >::operator() ( I  i) const
inlinenoexcept

Definition at line 813 of file Math.h.

◆ operator()() [2/2]

template<NumericOrFxVec T>
template<std::integral I>
T & FxArray< T >::operator() ( I  i)
inlinenoexcept

Definition at line 808 of file Math.h.

◆ operator*=() [1/2]

template<NumericOrFxVec T>
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & FxArray< T >::operator*= ( FxArray< U > const &  o)
inline

Definition at line 997 of file Math.h.

◆ operator*=() [2/2]

template<NumericOrFxVec T>
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & FxArray< T >::operator*= ( U const &  v)
inline

Definition at line 954 of file Math.h.

◆ operator+=() [1/2]

template<NumericOrFxVec T>
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & FxArray< T >::operator+= ( FxArray< U > const &  o)
inline

Definition at line 975 of file Math.h.

◆ operator+=() [2/2]

template<NumericOrFxVec T>
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & FxArray< T >::operator+= ( U const &  v)
inline

Definition at line 934 of file Math.h.

◆ operator-()

template<NumericOrFxVec T>
FxArray FxArray< T >::operator- ( ) const
inline

Definition at line 922 of file Math.h.

◆ operator-=() [1/2]

template<NumericOrFxVec T>
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & FxArray< T >::operator-= ( FxArray< U > const &  o)
inline

Definition at line 986 of file Math.h.

◆ operator-=() [2/2]

template<NumericOrFxVec T>
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & FxArray< T >::operator-= ( U const &  v)
inline

Definition at line 944 of file Math.h.

◆ operator/=() [1/2]

template<NumericOrFxVec T>
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & FxArray< T >::operator/= ( FxArray< U > const &  o)
inline

Definition at line 1008 of file Math.h.

◆ operator/=() [2/2]

template<NumericOrFxVec T>
template<typename U >
requires ConvertibleOrNumeric<U, T>
FxArray & FxArray< T >::operator/= ( U const &  v)
inline

Definition at line 964 of file Math.h.

◆ operator=() [1/4]

template<NumericOrFxVec T>
FxArray & FxArray< T >::operator= ( FxArray< T > &&  )
defaultnoexcept

◆ operator=() [2/4]

template<NumericOrFxVec T>
FxArray & FxArray< T >::operator= ( FxArray< T > const &  o)
inline

Definition at line 775 of file Math.h.

◆ operator=() [3/4]

template<NumericOrFxVec T>
FxArray & FxArray< T >::operator= ( std::initializer_list< T >  init)
inline

Definition at line 791 of file Math.h.

◆ operator=() [4/4]

template<NumericOrFxVec T>
FxArray & FxArray< T >::operator= ( std::vector< T > const &  v)
inline

Definition at line 783 of file Math.h.

◆ operator[]() [1/2]

template<NumericOrFxVec T>
T const & FxArray< T >::operator[] ( size_t  i) const
inlinenoexcept

Definition at line 805 of file Math.h.

◆ operator[]() [2/2]

template<NumericOrFxVec T>
T & FxArray< T >::operator[] ( size_t  i)
inlinenoexcept

Definition at line 804 of file Math.h.

◆ perp()

template<NumericOrFxVec T>
FxArray FxArray< T >::perp ( ) const
inline

Definition at line 1077 of file Math.h.

◆ perp_inplace()

template<NumericOrFxVec T>
FxArray & FxArray< T >::perp_inplace ( )
inlinenoexcept

Definition at line 1067 of file Math.h.

◆ rotate()

template<NumericOrFxVec T>
FxArray FxArray< T >::rotate ( float  degrees) const
inline

Definition at line 1095 of file Math.h.

◆ rotate_inplace()

template<NumericOrFxVec T>
FxArray & FxArray< T >::rotate_inplace ( float  degrees)
inlinenoexcept

Definition at line 1059 of file Math.h.

◆ rotate_inplace_rad()

template<NumericOrFxVec T>
FxArray & FxArray< T >::rotate_inplace_rad ( float  theta_rad)
inlinenoexcept

Definition at line 1044 of file Math.h.

◆ rotate_rad()

template<NumericOrFxVec T>
FxArray FxArray< T >::rotate_rad ( float  theta_rad) const
inline

Definition at line 1086 of file Math.h.

◆ size()

template<NumericOrFxVec T>
size_t FxArray< T >::size ( ) const
inlinenoexcept

Definition at line 834 of file Math.h.

◆ stddev()

template<NumericOrFxVec T>
float FxArray< T >::stddev ( ) const
inline

Definition at line 907 of file Math.h.

◆ swap()

template<NumericOrFxVec T>
void FxArray< T >::swap ( FxArray< T > &  o)
inlinenoexcept

Definition at line 839 of file Math.h.

◆ throw_if_empty()

template<NumericOrFxVec T>
void FxArray< T >::throw_if_empty ( char const *  what) const
inlineprotected

Definition at line 714 of file Math.h.

◆ throw_if_size_mismatch()

template<NumericOrFxVec T>
void FxArray< T >::throw_if_size_mismatch ( char const *  what,
size_t  o_size 
) const
inlineprotected

Definition at line 720 of file Math.h.


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