SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
Math.h File Reference
#include <bit>
#include <concepts>
#include <cmath>
#include <cstdint>
#include <numbers>
#include <type_traits>
#include <half.hpp>
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

struct  sourcepp::math::Vec< S, P >
 
struct  sourcepp::math::QuatCompressed48
 Lower precision Quat compressed to 6 bytes. More...
 
struct  sourcepp::math::QuatCompressed64
 Lower precision Quat compressed to 8 bytes. More...
 
class  sourcepp::math::Mat< M, N, P >
 

Namespaces

namespace  sourcepp
 
namespace  sourcepp::math
 

Concepts

concept  sourcepp::math::Arithmetic
 

Macros

#define SOURCEPP_VEC_DEFINE(S)
 
#define SOURCEPP_MAT_DEFINE(M, N)
 

Typedefs

using sourcepp::math::EulerAngles = Vec3f
 
using sourcepp::math::Quat = Vec4f
 

Functions

template<Arithmetic T>
constexpr T sourcepp::math::remap (T value, T l1, T h1, T l2, T h2)
 
template<Arithmetic T>
constexpr T sourcepp::math::remap (T value, T h1, T h2)
 
constexpr bool sourcepp::math::isPowerOf2 (std::unsigned_integral auto n)
 
template<std::unsigned_integral T>
constexpr T sourcepp::math::nearestPowerOf2 (T n)
 
constexpr uint16_t sourcepp::math::paddingForAlignment (uint16_t alignment, uint64_t n)
 
 sourcepp::math::SOURCEPP_VEC_DEFINE (2)
 
 sourcepp::math::SOURCEPP_VEC_DEFINE (3)
 
 sourcepp::math::SOURCEPP_VEC_DEFINE (4)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (2, 2)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (3, 3)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (4, 4)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (2, 3)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (3, 2)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (2, 4)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (4, 2)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (3, 4)
 
 sourcepp::math::SOURCEPP_MAT_DEFINE (4, 3)
 

Variables

template<std::floating_point F>
constexpr F sourcepp::math::pi = std::numbers::pi_v<F>
 
constexpr auto sourcepp::math::pi_f32 = pi<float>
 
constexpr auto sourcepp::math::pi_f64 = pi<double>
 

Macro Definition Documentation

◆ SOURCEPP_MAT_DEFINE

#define SOURCEPP_MAT_DEFINE (   M,
 
)
Value:
template<Arithmetic P> \
using Mat##M##x##N = Mat<M, N, P>; \
using Mat##M##x##N##i8 = Mat##M##x##N<int8_t>; \
using Mat##M##x##N##i16 = Mat##M##x##N<int16_t>; \
using Mat##M##x##N##i32 = Mat##M##x##N<int32_t>; \
using Mat##M##x##N##i64 = Mat##M##x##N<int64_t>; \
using Mat##M##x##N##i = Mat##M##x##N##i32; \
using Mat##M##x##N##ui8 = Mat##M##x##N<uint8_t>; \
using Mat##M##x##N##ui16 = Mat##M##x##N<uint16_t>; \
using Mat##M##x##N##ui32 = Mat##M##x##N<uint32_t>; \
using Mat##M##x##N##ui64 = Mat##M##x##N<uint64_t>; \
using Mat##M##x##N##ui = Mat##M##x##N##ui32; \
using Mat##M##x##N##f16 = Mat##M##x##N<half>; \
using Mat##M##x##N##f32 = Mat##M##x##N<float>; \
using Mat##M##x##N##f64 = Mat##M##x##N<double>; \
using Mat##M##x##N##f = Mat##M##x##N##f32

Definition at line 399 of file Math.h.

◆ SOURCEPP_VEC_DEFINE

#define SOURCEPP_VEC_DEFINE (   S)
Value:
template<Arithmetic P> \
using Vec##S = Vec<S, P>; \
using Vec##S##i8 = Vec##S<int8_t>; \
using Vec##S##i16 = Vec##S<int16_t>; \
using Vec##S##i32 = Vec##S<int32_t>; \
using Vec##S##i64 = Vec##S<int64_t>; \
using Vec##S##i = Vec##S##i32; \
using Vec##S##ui8 = Vec##S<uint8_t>; \
using Vec##S##ui16 = Vec##S<uint16_t>; \
using Vec##S##ui32 = Vec##S<uint32_t>; \
using Vec##S##ui64 = Vec##S<uint64_t>; \
using Vec##S##ui = Vec##S##ui32; \
using Vec##S##f16 = Vec##S<half>; \
using Vec##S##f32 = Vec##S<float>; \
using Vec##S##f64 = Vec##S<double>; \
using Vec##S##f = Vec##S##f32

Definition at line 304 of file Math.h.