Math Namespace Reference

Utility functions for vector and matrix types. More...

Functions

LM_INLINE auto Union (const Bound &a, const Bound &b) -> Bound
 Merge two bounds.
 
LM_INLINE auto Union (const Bound &a, const Vec3 &p) -> Bound
 Merge one bound and a point.
 
LM_INLINE auto IntersectBound (const Bound &bound, const Ray &ray, Float tMin, Float tMax) -> bool
 Intersection query between ray and bound.
 
template<typename T = Float>
constexpr auto Pi () -> T
 
template<typename T = Float>
constexpr auto InvPi () -> T
 
template<typename T = Float>
constexpr auto Inf () -> T
 
template<typename T = Float>
constexpr auto EpsLarge () -> T
 
template<>
constexpr auto EpsLarge< float > () -> float
 
template<typename T = Float>
constexpr auto Eps () -> T
 
template<>
constexpr auto Eps< float > () -> float
 
template<typename T = Float>
constexpr auto EpsIsect () -> T
 
template<typename T >
constexpr auto Radians (const T &v) -> T
 
template<typename T >
constexpr auto Degrees (const T &v) -> T
 
template<typename T >
LM_INLINE auto Cos (const T &v) -> T
 
template<typename T >
LM_INLINE auto Sin (const T &v) -> T
 
template<typename T >
LM_INLINE auto Tan (const T &v) -> T
 
template<typename T >
LM_INLINE auto Abs (const T &v) -> T
 
template<typename T >
LM_INLINE auto Sqrt (const T &v) -> T
 
template<typename T >
LM_INLINE auto Fract (const T &v) -> T
 
template<typename T >
LM_INLINE auto Pow (const T &base, const T &exp) -> T
 
template<typename T >
LM_INLINE auto Min (const T &v1, const T &v2) -> T
 
template<typename T >
LM_INLINE auto Max (const T &v1, const T &v2) -> T
 
template<typename T >
LM_INLINE auto Clamp (const T &v, const T &min, const T &max) -> T
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT>
LM_INLINE auto Min (const VecT< T, Opt > &v1, const VecT< T, Opt > &v2) -> VecT< T, Opt >
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT>
LM_INLINE auto Max (const VecT< T, Opt > &v1, const VecT< T, Opt > &v2) -> VecT< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto Dot (const TVec3< T, Opt > &v1, const TVec3< T, Opt > &v2) -> T
 
template<typename T , SIMD Opt>
LM_INLINE auto Dot (const TVec4< T, Opt > &v1, const TVec4< T, Opt > &v2) -> T
 
template<typename T , SIMD Opt>
LM_INLINE auto Cross (const TVec3< T, Opt > &v1, const TVec3< T, Opt > &v2) -> TVec3< T, Opt >
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT>
LM_INLINE T Length2 (const VecT< T, Opt > &v)
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT>
LM_INLINE auto Length (const VecT< T, Opt > &v) -> T
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT>
LM_INLINE auto Normalize (const VecT< T, Opt > &v) -> VecT< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto LocalCos (const TVec3< T, Opt > &v) -> T
 
template<typename T , SIMD Opt>
LM_INLINE auto LocalTan (const TVec3< T, Opt > &v) -> T
 
template<typename T , SIMD Opt>
LM_INLINE auto IsZero (const TVec3< T, Opt > &v) -> bool
 
template<typename T , SIMD Opt>
LM_INLINE auto Transpose (const TMat3< T, Opt > &m) -> TMat3< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto Transpose (const TMat4< T, Opt > &m) -> TMat4< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto Inverse (const TMat3< T, Opt > &m) -> TMat3< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto Inverse (const TMat4< T, Opt > &m) -> TMat4< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE TMat4< T, Opt > Translate (const TMat4< T, Opt > &m, const TVec3< T, Opt > &v)
 
template<typename T , SIMD Opt>
LM_INLINE TMat4< T, Opt > Translate (const TVec3< T, Opt > &v)
 
template<typename T , SIMD Opt>
LM_INLINE TMat4< T, Opt > Rotate (const TMat4< T, Opt > &m, const T &angle, const TVec3< T, Opt > &axis)
 
template<typename T , SIMD Opt>
LM_INLINE TMat4< T, Opt > Rotate (const T &angle, const TVec3< T, Opt > &axis)
 
template<typename T , SIMD Opt>
LM_INLINE TMat4< T, Opt > Scale (const TMat4< T, Opt > &m, const TVec3< T, Opt > &v)
 
template<typename T , SIMD Opt>
LM_INLINE TMat4< T, Opt > Scale (const TVec3< T, Opt > &v)
 
template<typename T , SIMD Opt>
auto OrthonormalBasis (const TVec3< T, Opt > &a, TVec3< T, Opt > &b, TVec3< T, Opt > &c) -> void
 

Detailed Description

Utility functions for vector and matrix types.