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

#include <Math.h>

Public Member Functions

 FxVec ()=default
 FxVec (const FxVec &)=default
FxVec & operator= (const FxVec &) &=default
constexpr FxVec (T a) noexcept
template<Numeric... A>
requires (sizeof...(A) == N)
constexpr FxVec (A... values) noexcept
constexpr T & operator[] (std::size_t i) noexcept
constexpr const T & operator[] (std::size_t i) const noexcept
constexpr T * data () noexcept
constexpr const T * data () const noexcept
constexpr T & x () noexcept
constexpr T & y () noexcept
constexpr T & z () noexcept
constexpr T & theta () noexcept
constexpr T & a () noexcept
constexpr T x () const noexcept
constexpr T y () const noexcept
constexpr T z () const noexcept
constexpr T theta () const noexcept
constexpr T a () const noexcept
constexpr void set_x (T val) noexcept
constexpr void set_y (T val) noexcept
constexpr void set_z (T val) noexcept
constexpr void set_theta (T val) noexcept
constexpr void set_a (T val) noexcept
constexpr FxVec< T, 2 > xy () const noexcept
constexpr FxVec< T, 2 > get_xy () const noexcept
constexpr void set_xy (const FxVec< T, 2 > &v2) noexcept
constexpr T dot (const FxVec &other) const noexcept
constexpr T squaredNorm () const noexcept
T norm () const noexcept
FxVec normalized () const noexcept
constexpr T cross (const FxVec &other) const noexcept
constexpr FxVec perp () const noexcept
constexpr FxVec perpCW () const noexcept
FxVec & rotate_inplace_rad (T theta) &noexcept
FxVec & rotate_inplace (T degrees) &noexcept
FxVec rotate (T degrees) const noexcept
FxVec rotate_rad (T theta) const noexcept
constexpr FxVec & operator+= (const FxVec &rhs) &noexcept
constexpr FxVec & operator-= (const FxVec &rhs) &noexcept
constexpr FxVec & operator*= (const FxVec &rhs) &noexcept
constexpr FxVec & operator/= (const FxVec &rhs) &noexcept
template<Numeric S>
constexpr FxVec & operator+= (S s) &noexcept
template<Numeric S>
constexpr FxVec & operator-= (S s) &noexcept
template<Numeric S>
constexpr FxVec & operator*= (S s) &noexcept
template<Numeric S>
constexpr FxVec & operator/= (S s) &noexcept

Friends

constexpr FxVec operator+ (FxVec lhs, const FxVec &rhs) noexcept
constexpr FxVec operator- (FxVec lhs, const FxVec &rhs) noexcept
constexpr FxVec operator- (FxVec v) noexcept
constexpr bool operator== (const FxVec &lhs, const FxVec &rhs) noexcept
template<Numeric S>
constexpr FxVec operator* (FxVec v, S s) noexcept
template<Numeric S>
constexpr FxVec operator* (S s, FxVec v) noexcept
template<Numeric S>
constexpr FxVec operator/ (FxVec v, S s) noexcept
template<Numeric S>
constexpr FxVec operator+ (FxVec v, S s) noexcept
template<Numeric S>
constexpr FxVec operator+ (S s, FxVec v) noexcept
template<Numeric S>
constexpr FxVec operator- (FxVec v, S s) noexcept
template<Numeric S>
constexpr FxVec operator- (S s, FxVec v) noexcept
template<Numeric S>
constexpr FxVec operator/ (S s, FxVec v) noexcept

Detailed Description

template<typename T, int N>
class FxVec< T, N >

Definition at line 148 of file Math.h.

Constructor & Destructor Documentation

◆ FxVec() [1/4]

template<typename T, int N>
FxVec< T, N >::FxVec ( )
default

◆ FxVec() [2/4]

template<typename T, int N>
FxVec< T, N >::FxVec ( const FxVec< T, N > & )
default

◆ FxVec() [3/4]

template<typename T, int N>
FxVec< T, N >::FxVec ( T a)
inlineexplicitconstexprnoexcept

Definition at line 156 of file Math.h.

◆ FxVec() [4/4]

template<typename T, int N>
template<Numeric... A>
requires (sizeof...(A) == N)
FxVec< T, N >::FxVec ( A... values)
inlineconstexprnoexcept

Definition at line 163 of file Math.h.

Member Function Documentation

◆ a() [1/2]

template<typename T, int N>
T FxVec< T, N >::a ( ) const
inlineconstexprnoexcept

Definition at line 204 of file Math.h.

◆ a() [2/2]

template<typename T, int N>
T & FxVec< T, N >::a ( )
inlineconstexprnoexcept

Definition at line 185 of file Math.h.

◆ cross()

template<typename T, int N>
T FxVec< T, N >::cross ( const FxVec< T, N > & other) const
inlineconstexprnoexcept

Definition at line 269 of file Math.h.

◆ data() [1/2]

template<typename T, int N>
const T * FxVec< T, N >::data ( ) const
inlineconstexprnoexcept

Definition at line 169 of file Math.h.

◆ data() [2/2]

template<typename T, int N>
T * FxVec< T, N >::data ( )
inlineconstexprnoexcept

Definition at line 168 of file Math.h.

◆ dot()

template<typename T, int N>
T FxVec< T, N >::dot ( const FxVec< T, N > & other) const
inlineconstexprnoexcept

Definition at line 249 of file Math.h.

◆ get_xy()

template<typename T, int N>
FxVec< T, 2 > FxVec< T, N >::get_xy ( ) const
inlineconstexprnoexcept

Definition at line 236 of file Math.h.

◆ norm()

template<typename T, int N>
T FxVec< T, N >::norm ( ) const
inlinenoexcept

Definition at line 253 of file Math.h.

◆ normalized()

template<typename T, int N>
FxVec FxVec< T, N >::normalized ( ) const
inlinenoexcept

Definition at line 260 of file Math.h.

◆ operator*=() [1/2]

template<typename T, int N>
FxVec & FxVec< T, N >::operator*= ( const FxVec< T, N > & rhs) &
inlineconstexprnoexcept

Definition at line 332 of file Math.h.

◆ operator*=() [2/2]

template<typename T, int N>
template<Numeric S>
FxVec & FxVec< T, N >::operator*= ( S s) &
inlineconstexprnoexcept

Definition at line 353 of file Math.h.

◆ operator+=() [1/2]

template<typename T, int N>
FxVec & FxVec< T, N >::operator+= ( const FxVec< T, N > & rhs) &
inlineconstexprnoexcept

Definition at line 324 of file Math.h.

◆ operator+=() [2/2]

template<typename T, int N>
template<Numeric S>
FxVec & FxVec< T, N >::operator+= ( S s) &
inlineconstexprnoexcept

Definition at line 343 of file Math.h.

◆ operator-=() [1/2]

template<typename T, int N>
FxVec & FxVec< T, N >::operator-= ( const FxVec< T, N > & rhs) &
inlineconstexprnoexcept

Definition at line 328 of file Math.h.

◆ operator-=() [2/2]

template<typename T, int N>
template<Numeric S>
FxVec & FxVec< T, N >::operator-= ( S s) &
inlineconstexprnoexcept

Definition at line 348 of file Math.h.

◆ operator/=() [1/2]

template<typename T, int N>
FxVec & FxVec< T, N >::operator/= ( const FxVec< T, N > & rhs) &
inlineconstexprnoexcept

Definition at line 336 of file Math.h.

◆ operator/=() [2/2]

template<typename T, int N>
template<Numeric S>
FxVec & FxVec< T, N >::operator/= ( S s) &
inlineconstexprnoexcept

Definition at line 358 of file Math.h.

◆ operator=()

template<typename T, int N>
FxVec & FxVec< T, N >::operator= ( const FxVec< T, N > & ) &
default

◆ operator[]() [1/2]

template<typename T, int N>
const T & FxVec< T, N >::operator[] ( std::size_t i) const
inlineconstexprnoexcept

Definition at line 167 of file Math.h.

◆ operator[]() [2/2]

template<typename T, int N>
T & FxVec< T, N >::operator[] ( std::size_t i)
inlineconstexprnoexcept

Definition at line 166 of file Math.h.

◆ perp()

template<typename T, int N>
FxVec FxVec< T, N >::perp ( ) const
inlineconstexprnoexcept

Definition at line 276 of file Math.h.

◆ perpCW()

template<typename T, int N>
FxVec FxVec< T, N >::perpCW ( ) const
inlineconstexprnoexcept

Definition at line 281 of file Math.h.

◆ rotate()

template<typename T, int N>
FxVec FxVec< T, N >::rotate ( T degrees) const
inlinenoexcept

Definition at line 308 of file Math.h.

◆ rotate_inplace()

template<typename T, int N>
FxVec & FxVec< T, N >::rotate_inplace ( T degrees) &
inlinenoexcept

Definition at line 300 of file Math.h.

◆ rotate_inplace_rad()

template<typename T, int N>
FxVec & FxVec< T, N >::rotate_inplace_rad ( T theta) &
inlinenoexcept

Definition at line 288 of file Math.h.

◆ rotate_rad()

template<typename T, int N>
FxVec FxVec< T, N >::rotate_rad ( T theta) const
inlinenoexcept

Definition at line 315 of file Math.h.

◆ set_a()

template<typename T, int N>
void FxVec< T, N >::set_a ( T val)
inlineconstexprnoexcept

Definition at line 224 of file Math.h.

◆ set_theta()

template<typename T, int N>
void FxVec< T, N >::set_theta ( T val)
inlineconstexprnoexcept

Definition at line 219 of file Math.h.

◆ set_x()

template<typename T, int N>
void FxVec< T, N >::set_x ( T val)
inlineconstexprnoexcept

Definition at line 211 of file Math.h.

◆ set_xy()

template<typename T, int N>
void FxVec< T, N >::set_xy ( const FxVec< T, 2 > & v2)
inlineconstexprnoexcept

Definition at line 241 of file Math.h.

◆ set_y()

template<typename T, int N>
void FxVec< T, N >::set_y ( T val)
inlineconstexprnoexcept

Definition at line 212 of file Math.h.

◆ set_z()

template<typename T, int N>
void FxVec< T, N >::set_z ( T val)
inlineconstexprnoexcept

Definition at line 213 of file Math.h.

◆ squaredNorm()

template<typename T, int N>
T FxVec< T, N >::squaredNorm ( ) const
inlineconstexprnoexcept

Definition at line 252 of file Math.h.

◆ theta() [1/2]

template<typename T, int N>
T FxVec< T, N >::theta ( ) const
inlineconstexprnoexcept

Definition at line 199 of file Math.h.

◆ theta() [2/2]

template<typename T, int N>
T & FxVec< T, N >::theta ( )
inlineconstexprnoexcept

Definition at line 180 of file Math.h.

◆ x() [1/2]

template<typename T, int N>
T FxVec< T, N >::x ( ) const
inlineconstexprnoexcept

Definition at line 192 of file Math.h.

◆ x() [2/2]

template<typename T, int N>
T & FxVec< T, N >::x ( )
inlineconstexprnoexcept

Definition at line 172 of file Math.h.

◆ xy()

template<typename T, int N>
FxVec< T, 2 > FxVec< T, N >::xy ( ) const
inlineconstexprnoexcept

Definition at line 231 of file Math.h.

◆ y() [1/2]

template<typename T, int N>
T FxVec< T, N >::y ( ) const
inlineconstexprnoexcept

Definition at line 193 of file Math.h.

◆ y() [2/2]

template<typename T, int N>
T & FxVec< T, N >::y ( )
inlineconstexprnoexcept

Definition at line 173 of file Math.h.

◆ z() [1/2]

template<typename T, int N>
T FxVec< T, N >::z ( ) const
inlineconstexprnoexcept

Definition at line 194 of file Math.h.

◆ z() [2/2]

template<typename T, int N>
T & FxVec< T, N >::z ( )
inlineconstexprnoexcept

Definition at line 174 of file Math.h.

◆ operator* [1/2]

template<typename T, int N>
template<Numeric S>
FxVec operator* ( FxVec< T, N > v,
S s )
friend

Definition at line 378 of file Math.h.

◆ operator* [2/2]

template<typename T, int N>
template<Numeric S>
FxVec operator* ( S s,
FxVec< T, N > v )
friend

Definition at line 382 of file Math.h.

◆ operator+ [1/3]

template<typename T, int N>
FxVec operator+ ( FxVec< T, N > lhs,
const FxVec< T, N > & rhs )
friend

Definition at line 364 of file Math.h.

◆ operator+ [2/3]

template<typename T, int N>
template<Numeric S>
FxVec operator+ ( FxVec< T, N > v,
S s )
friend

Definition at line 390 of file Math.h.

◆ operator+ [3/3]

template<typename T, int N>
template<Numeric S>
FxVec operator+ ( S s,
FxVec< T, N > v )
friend

Definition at line 394 of file Math.h.

◆ operator- [1/4]

template<typename T, int N>
FxVec operator- ( FxVec< T, N > lhs,
const FxVec< T, N > & rhs )
friend

Definition at line 365 of file Math.h.

◆ operator- [2/4]

template<typename T, int N>
FxVec operator- ( FxVec< T, N > v)
friend

Definition at line 366 of file Math.h.

◆ operator- [3/4]

template<typename T, int N>
template<Numeric S>
FxVec operator- ( FxVec< T, N > v,
S s )
friend

Definition at line 398 of file Math.h.

◆ operator- [4/4]

template<typename T, int N>
template<Numeric S>
FxVec operator- ( S s,
FxVec< T, N > v )
friend

Definition at line 402 of file Math.h.

◆ operator/ [1/2]

template<typename T, int N>
template<Numeric S>
FxVec operator/ ( FxVec< T, N > v,
S s )
friend

Definition at line 386 of file Math.h.

◆ operator/ [2/2]

template<typename T, int N>
template<Numeric S>
FxVec operator/ ( S s,
FxVec< T, N > v )
friend

Definition at line 407 of file Math.h.

◆ operator==

template<typename T, int N>
bool operator== ( const FxVec< T, N > & lhs,
const FxVec< T, N > & rhs )
friend

Definition at line 370 of file Math.h.


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