darts/vec.h file

Contains various classes for linear algebra: vectors, matrices, rays, axis-aligned bounding boxes.

Typedefs

template<int N, class T>
using Vec = linalg::vec<T, N>
Generic N dimensional vector.
template<class T, int M, int N>
using Mat = linalg::mat<T, M, N>
Generic M x N matrix.
template<class T>
using Vec2 = Vec<2, T>
2D vector of type T
template<class T>
using Vec3 = Vec<3, T>
3D vector of type T
template<class T>
using Vec4 = Vec<4, T>
4D vector of type T
template<class T>
using Color3 = Vec<3, T>
RGB color of type T.
template<class T>
using Color4 = Vec<4, T>
RGBA color of type T.
using Vec2f = Vec2<float>
2D float vector
using Vec2d = Vec2<double>
2D double vector
using Vec2i = Vec2<std::int32_t>
2D integer vector (32-bit)
using Vec2u = Vec2<std::uint32_t>
2D unsigned vector (32-bit)
using Vec2c = Vec2<std::uint8_t>
2D character vector (8-bit unsigned integers)
using Vec3f = Vec3<float>
3D float vector
using Vec3d = Vec3<double>
3D double vector
using Vec3i = Vec3<std::int32_t>
3D integer vector (32-bit)
using Vec3u = Vec3<std::uint32_t>
3D unsigned vector (32-bit)
using Vec3c = Vec3<std::uint8_t>
3D character vector (8-bit unsigned integers)
using Color3f = Vec3<float>
RGB float color.
using Color3d = Vec3<double>
RGB double color.
using Color3u = Vec3<std::uint32_t>
RGB 32-bit unsigned integer color.
using Color3c = Vec3<std::uint8_t>
RGB 8-bit unsigned integer.
using Vec4f = Vec4<float>
4D float vector
using Vec4d = Vec4<double>
4D double vector
using Vec4i = Vec4<std::int32_t>
4D integer vector (32-bit)
using Vec4u = Vec4<std::uint32_t>
4D unsigned vector (32-bit)
using Vec4c = Vec4<std::uint8_t>
4D character vector (8-bit unsigned integers)
using Color4f = Vec4<float>
RGBA float color.
using Color4d = Vec4<double>
RGBA double color.
using Color4u = Vec4<std::uint32_t>
RGBA 32-bit unsigned integer color.
using Color4c = Vec4<std::uint8_t>
RGBA 8-bit unsigned integer.
template<class T>
using Mat22 = linalg::mat<T, 2, 2>
A generic 2x2 matrix.
template<class T>
using Mat33 = linalg::mat<T, 3, 3>
A generic 3x3 matrix.
template<class T>
using Mat44 = linalg::mat<T, 4, 4>
A generic 4x4 matrix.
using Mat22f = Mat22<float>
2x2 float matrix
using Mat22d = Mat22<double>
2x2 double matrix
using Mat33f = Mat33<float>
3x3 float matrix
using Mat33d = Mat33<double>
3x3 double matrix
using Mat44f = Mat44<float>
4x4 float matrix
using Mat44d = Mat44<double>
4x4 double matrix

Functions

template<typename T>
void coordinate_system(const Vec3<T>& a, Vec3<T>& b, Vec3<T>& c)
Construct an orthonormal coordinate system given one vector a.
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 is_valid_color(const Color3f& c) -> bool
Check if the color vector contains a NaN/Inf/negative value.
auto luminance(const Color3f& c) -> float
Return the associated luminance.