Basic math objects. More...

Classes

struct  TVec4< T, Opt >
 4D vector. More...
 
struct  TVec4< T, SIMD::None >
 Default specialization for 4D vector type. More...
 
struct  TVec3< T, Opt >
 3D vector. More...
 
struct  TVec3< T, SIMD::None >
 Default specialization for 3D vector type. More...
 
struct  TVec2< T, Opt >
 2D vector. More...
 
struct  TVec2< T, SIMD::None >
 Default specialization for 2D vector type. More...
 
struct  TMat4< T, Opt >
 4x4 matrix. More...
 
struct  TMat3< T, Opt >
 3x3 matrix. More...
 

Typedefs

template<typename T , SIMD Opt, template< typename, SIMD > class MathObject>
using EnableIfVecType = std::enable_if_t< MathObject< T, Opt >::ObjT==MathObjectType::Vec >
 
template<typename T , SIMD Opt, template< typename, SIMD > class MathObject>
using EnableIfMatType = std::enable_if_t< MathObject< T, Opt >::ObjT==MathObjectType::Mat >
 
template<typename T , SIMD Opt>
using EnableIfSSEType = std::enable_if_t< std::is_same< T, float >::value &&Opt==SIMD::SSE >
 
template<typename T , SIMD Opt>
using EnableIfAVXType = std::enable_if_t< std::is_same< T, double >::value &&Opt==SIMD::AVX >
 

Enumerations

enum  SIMD { None, SSE, AVX }
 SIMD flags.Specified SIMD optimization. The flag is passed as a template parameter for the basic math types. More...
 

Functions

template<typename T , template< typename, SIMD > class VecT>
LM_INLINE auto operator+ (const VecT< T, SIMD::None > &v1, const VecT< T, SIMD::None > &v2) -> VecT< T, SIMD::None >
 
template<template< typename, SIMD > class VecT>
LM_INLINE auto operator+ (const VecT< float, SIMD::SSE > &v1, const VecT< float, SIMD::SSE > &v2) -> VecT< float, SIMD::SSE >
 
template<template< typename, SIMD > class VecT>
LM_INLINE auto operator+ (const VecT< double, SIMD::AVX > &v1, const VecT< double, SIMD::AVX > &v2) -> VecT< double, SIMD::AVX >
 
template<typename T , template< typename, SIMD > class VecT>
LM_INLINE auto operator- (const VecT< T, SIMD::None > &v1, const VecT< T, SIMD::None > &v2) -> VecT< T, SIMD::None >
 
template<template< typename, SIMD > class VecT>
LM_INLINE auto operator- (const VecT< float, SIMD::SSE > &v1, const VecT< float, SIMD::SSE > &v2) -> VecT< float, SIMD::SSE >
 
template<template< typename, SIMD > class VecT>
LM_INLINE auto operator- (const VecT< double, SIMD::AVX > &v1, const VecT< double, SIMD::AVX > &v2) -> VecT< double, SIMD::AVX >
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT, typename = EnableIfVecType<T, Opt, VecT>>
LM_INLINE auto operator* (const VecT< T, Opt > &v1, const VecT< T, Opt > &v2) -> VecT< T, Opt >
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT, typename = EnableIfVecType<T, Opt, VecT>>
LM_INLINE auto operator* (const VecT< T, Opt > &v, const T &s) -> VecT< T, Opt >
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT, typename = EnableIfVecType<T, Opt, VecT>>
LM_INLINE auto operator* (const T &s, const VecT< T, Opt > &v) -> VecT< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto operator* (const TMat3< T, Opt > &m1, const TMat3< T, Opt > &m2) -> TMat3< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto operator* (const TMat4< T, Opt > &m1, const TMat4< T, Opt > &m2) -> TMat4< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto operator* (const TMat3< T, Opt > &m, const TVec3< T, Opt > &v) -> TVec3< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto operator* (const TMat4< T, Opt > &m, const TVec4< T, Opt > &v) -> TVec4< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto operator* (const TMat3< T, Opt > &m, const T &s) -> TMat3< T, Opt >
 
template<typename T , SIMD Opt>
LM_INLINE auto operator* (const TMat4< T, Opt > &m, const T &s) -> TMat4< T, Opt >
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT>
LM_INLINE auto operator/ (const VecT< T, Opt > &v1, const VecT< T, Opt > &v2) -> VecT< T, Opt >
 
template<typename T , SIMD Opt, template< typename, SIMD > class VecT, typename = EnableIfVecType<T, Opt, VecT>>
LM_INLINE auto operator/ (const VecT< T, Opt > &v, const T &s) -> VecT< T, Opt >
 
template<typename T , template< typename, SIMD > class VecT>
LM_INLINE auto operator- (const VecT< T, SIMD::None > &v) -> VecT< T, SIMD::None >
 

Detailed Description

Basic math objects.

Enumeration Type Documentation

enum SIMD
strong

SIMD flags.Specified SIMD optimization. The flag is passed as a template parameter for the basic math types.

  • None: No optimization
  • SSE: Enables SSE. Requires support of SSE, SSE2, SSE3, SSE4.x
  • AVX: Enables AVX. Requires support of AVX, AVX2
  • Default: Default optimization flag
    • SSE if LM_USE_SSE and LM_USE_SINGLE_PRECISION are defined
    • AVX if LM_AVX_SSE and LM_USE_DOUBLE_PRECISION are defined
    • None otherwise