file
math.hContains various classes for linear algebra: vectors, matrices, rays, axis-aligned bounding boxes.
Functions
-
template<typename T>auto coordinate_system(const Vec3<T>& z) -> std::pair<Vec3<T>, Vec3<T>>
- Construct an orthonormal coordinate system given one vector
a
.
Math constants
A few useful constants
- #define M_PI
- #define INV_PI
- #define INV_TWOPI
- #define INV_FOURPI
- #define SQRT_TWO
- #define INV_SQRT_TWO
Basic darts vector/matrix/color types
-
template<int N, class T>using Vec = la::vec<T, N>
- Generic
N
dimensional vector. -
template<class T, int M, int N>using Mat = la::mat<T, M, N>
- Generic
M
xN
matrix. -
template<int N, class T>using Color = la::vec<T, N>
- Generic
N
dimensional color. -
template<class T>using Color3 = Color<3, T>
- RGB color of type T.
-
template<class T>using Color4 = Color<4, T>
- RGBA color of type T.
Interpolation utilities
-
template<typename T>auto mod(T a, T b) -> T
- Always-positive modulo operation.
Color utilities
Working with colors
- auto to_sRGB(const Color3f& c) -> Color3f
- Convert from linear RGB to sRGB.
- auto to_linear_RGB(const Color3f& c) -> Color3f
- Convert from sRGB to linear RGB.
- auto luminance(const Color3f& c) -> float
- Return the associated luminance.
- auto viridis(float t) -> Color3f
- Evaluate the Matplotlib viridis colormap.
- auto inferno(float t) -> Color3f
- Evaluate the Matplotlib inferno colormap.
- auto magma(float t) -> Color3f
- Evaluate the Matplotlib magma colormap.
- auto plasma(float t) -> Color3f
- Evaluate the Matplotlib plasma colormap.