Fx2D
A C++20 2D rigid-body physics engine
Loading...
Searching...
No Matches
Math.h File Reference
#include <algorithm>
#include <cmath>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <iostream>
#include <limits>
#include <memory>
#include <new>
#include <numbers>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for Math.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FxVec< T, N >
class  FxMat< T, N >
class  FxMat2f
 2×2 floating-point matrix. More...
class  FxMat3f
 3×3 floating-point matrix. More...
struct  FxArrayAlignedDelete< T >
class  FxArray< T >
 Fixed-size, aligned value array. More...

Namespaces

namespace  fx_detail

Concepts

concept  Numeric
concept  NumericOrFxVec
concept  FxVecT
concept  ConvertibleOrNumeric

Typedefs

using FxVec2f = FxVec<float, 2>
using FxVec2d = FxVec<double, 2>
using FxVec3f = FxVec<float, 3>
using FxVec3d = FxVec<double, 3>
using FxVec4f = FxVec<float, 4>
using FxVec2ui = FxVec<unsigned int, 2>
using FxVec4ui8 = FxVec<uint8_t, 4>
using FxVec2fArray = FxArray<FxVec2f>

Functions

template<typename T, int N>
constexpr T fx_detail::dot (const T *a, const T *b) noexcept
template<int N, typename F>
constexpr void fx_detail::unrolled (F &&f) noexcept
template<NumericOrFxVec T>
void swap (FxArray< T > &a, FxArray< T > &b) noexcept
template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator+ (FxArray< T > a, U const &scalar)
template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator- (FxArray< T > a, U const &scalar)
template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator* (FxArray< T > a, U const &scalar)
template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator/ (FxArray< T > a, U const &scalar)
template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator+ (U const &scalar, FxArray< T > a)
template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator* (U const &scalar, FxArray< T > a)
template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator- (U const &scalar, FxArray< T > a)
template<typename T, Numeric U>
FxArray< T > operator/ (U const &scalar, FxArray< T > const &a)
template<typename T>
FxArray< T > operator/ (T const &scalar, FxArray< T > const &a)
template<typename T>
FxArray< T > operator+ (FxArray< T > a, const FxArray< T > &b)
template<typename T>
FxArray< T > operator- (FxArray< T > a, const FxArray< T > &b)
template<typename T>
FxArray< T > operator* (FxArray< T > a, const FxArray< T > &b)
template<typename T>
FxArray< T > operator/ (FxArray< T > a, const FxArray< T > &b)
template<Numeric T>
std::ostream & operator<< (std::ostream &os, FxArray< T > const &a)
std::ostream & operator<< (std::ostream &os, FxVec2fArray const &a)
std::ostream & operator<< (std::ostream &os, FxVec2f const &a)
std::ostream & operator<< (std::ostream &os, FxVec3f const &a)

Typedef Documentation

◆ FxVec2d

using FxVec2d = FxVec<double, 2>

Definition at line 417 of file Math.h.

◆ FxVec2f

using FxVec2f = FxVec<float, 2>

Definition at line 416 of file Math.h.

◆ FxVec2fArray

Definition at line 1075 of file Math.h.

◆ FxVec2ui

using FxVec2ui = FxVec<unsigned int, 2>

Definition at line 421 of file Math.h.

◆ FxVec3d

using FxVec3d = FxVec<double, 3>

Definition at line 419 of file Math.h.

◆ FxVec3f

using FxVec3f = FxVec<float, 3>

Definition at line 418 of file Math.h.

◆ FxVec4f

using FxVec4f = FxVec<float, 4>

Definition at line 420 of file Math.h.

◆ FxVec4ui8

using FxVec4ui8 = FxVec<uint8_t, 4>

Definition at line 422 of file Math.h.

Function Documentation

◆ operator*() [1/3]

template<typename T>
FxArray< T > operator* ( FxArray< T > a,
const FxArray< T > & b )
inline

Definition at line 1154 of file Math.h.

◆ operator*() [2/3]

template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator* ( FxArray< T > a,
U const & scalar )
inline

Definition at line 1092 of file Math.h.

◆ operator*() [3/3]

template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator* ( U const & scalar,
FxArray< T > a )
inline

Definition at line 1111 of file Math.h.

◆ operator+() [1/3]

template<typename T>
FxArray< T > operator+ ( FxArray< T > a,
const FxArray< T > & b )
inline

Definition at line 1144 of file Math.h.

◆ operator+() [2/3]

template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator+ ( FxArray< T > a,
U const & scalar )
inline

Definition at line 1080 of file Math.h.

◆ operator+() [3/3]

template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator+ ( U const & scalar,
FxArray< T > a )
inline

Definition at line 1105 of file Math.h.

◆ operator-() [1/3]

template<typename T>
FxArray< T > operator- ( FxArray< T > a,
const FxArray< T > & b )
inline

Definition at line 1149 of file Math.h.

◆ operator-() [2/3]

template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator- ( FxArray< T > a,
U const & scalar )
inline

Definition at line 1086 of file Math.h.

◆ operator-() [3/3]

template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator- ( U const & scalar,
FxArray< T > a )
inline

Definition at line 1117 of file Math.h.

◆ operator/() [1/4]

template<typename T>
FxArray< T > operator/ ( FxArray< T > a,
const FxArray< T > & b )
inline

Definition at line 1159 of file Math.h.

◆ operator/() [2/4]

template<typename T, typename U>
requires ConvertibleOrNumeric<U, T>
FxArray< T > operator/ ( FxArray< T > a,
U const & scalar )
inline

Definition at line 1098 of file Math.h.

◆ operator/() [3/4]

template<typename T>
FxArray< T > operator/ ( T const & scalar,
FxArray< T > const & a )
inline

Definition at line 1133 of file Math.h.

◆ operator/() [4/4]

template<typename T, Numeric U>
FxArray< T > operator/ ( U const & scalar,
FxArray< T > const & a )
inline

Definition at line 1123 of file Math.h.

◆ operator<<() [1/4]

template<Numeric T>
std::ostream & operator<< ( std::ostream & os,
FxArray< T > const & a )
inline

Definition at line 1164 of file Math.h.

◆ operator<<() [2/4]

std::ostream & operator<< ( std::ostream & os,
FxVec2f const & a )
inline

Definition at line 1180 of file Math.h.

◆ operator<<() [3/4]

std::ostream & operator<< ( std::ostream & os,
FxVec2fArray const & a )
inline

Definition at line 1172 of file Math.h.

◆ operator<<() [4/4]

std::ostream & operator<< ( std::ostream & os,
FxVec3f const & a )
inline

Definition at line 1187 of file Math.h.

◆ swap()

template<NumericOrFxVec T>
void swap ( FxArray< T > & a,
FxArray< T > & b )
noexcept

Definition at line 1068 of file Math.h.