Antkeeper
0.0.1
|
Mathematical functions and data types. More...
Namespaces | |
compile | |
Compile-time mathematical functions. | |
hash | |
Hash functions. | |
literals | |
User-defined math literals. | |
matrix_types | |
Matrix types. | |
noise | |
Noise functions. | |
numbers | |
Mathematical constants. | |
operators | |
Mathematical operators. | |
polynomial | |
Polynomial functions. | |
quadrature | |
Numerical integration functions. | |
quaternion_types | |
Quaternion types. | |
types | |
Linear algebra data types. | |
vector_types | |
Vector types. | |
Classes | |
struct | matrix |
n by m column-major matrix. More... | |
class | moving_average |
Calculates a moving average. More... | |
struct | quaternion |
Quaternion composed of a real scalar part and imaginary vector part. More... | |
struct | se3 |
SE(3) proper rigid transformation (rototranslation). More... | |
struct | transform |
SRT transformation. More... | |
struct | vector |
n-dimensional vector. More... | |
Enumerations | |
enum class | rotation_sequence : std::uint8_t { zxz = 0b100010 , xyx = 0b000100 , yzy = 0b011001 , zyz = 0b100110 , xzx = 0b001000 , yxy = 0b010001 , xyz = 0b100100 , yzx = 0b001001 , zxy = 0b010010 , xzy = 0b011000 , zyx = 0b000110 , yxz = 0b100001 } |
Rotation sequences of proper Euler and Tait-Bryan angles. More... | |
Functions | |
template<class T > | |
constexpr T | degrees (T radians) noexcept |
Converts an angle from radians to degrees. More... | |
template<class T > | |
constexpr T | radians (T degrees) noexcept |
Converts an angle given in degrees to radians. More... | |
template<class T > | |
constexpr T | wrap_degrees (T degrees) |
Wraps an angle to [-180, 180]. More... | |
template<class T > | |
constexpr T | wrap_radians (T radians) |
Wraps an angle to [-pi, pi]. More... | |
template<std::integral T> | |
constexpr vec3< T > | rotation_axes (rotation_sequence sequence) noexcept |
Returns the indices of the axes of a rotation sequence. More... | |
template<std::floating_point T> | |
T | fract (T x) |
Returns the fractional part of a floating-point number. More... | |
template<typename T , typename S = float> | |
constexpr T | lerp (const T &x, const T &y, S a) noexcept |
Linearly interpolates between x and y . More... | |
template<typename T > | |
constexpr T | lerp_angle (T x, T y, T a) |
Linearly interpolates between two angles, x and y . More... | |
template<typename T , typename S = float> | |
T | log_lerp (const T &x, const T &y, S a) |
Logarithmically interpolates between x and y . More... | |
template<class T > | |
constexpr T | map (T x, T from_min, T from_max, T to_min, T to_max) noexcept |
Remaps a number from one range to another. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | add (const matrix< T, N, M > &a, const matrix< T, N, M > &b) noexcept |
Adds two matrices. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | add (const matrix< T, N, M > &a, T b) noexcept |
Adds a matrix and a scalar. More... | |
template<class T , std::size_t N> | |
constexpr T | determinant (const matrix< T, N, N > &m) noexcept |
Calculates the determinant of a square matrix. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | componentwise_mul (const matrix< T, N, M > &a, const matrix< T, N, M > &b) noexcept |
Performs a component-wise multiplication of two matrices. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | div (const matrix< T, N, M > &a, const matrix< T, N, M > &b) noexcept |
Divides a matrix by a matrix. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | div (const matrix< T, N, M > &a, T b) noexcept |
Divides a matrix by a scalar. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | div (T a, const matrix< T, N, M > &b) noexcept |
Divides a scalar by a matrix. More... | |
template<class T , std::size_t N> | |
constexpr matrix< T, N, N > | inverse (const matrix< T, N, N > &m) noexcept |
Calculates the inverse of a square matrix. More... | |
template<class T > | |
constexpr mat4< T > | look_at_rh (const vec3< T > &position, const vec3< T > &target, const vec3< T > &up) |
Constructs a right-handed viewing transformation matrix. More... | |
template<class T > | |
constexpr std::tuple< mat4< T >, mat4< T > > | look_at_rh_inv (const vec3< T > &position, const vec3< T > &target, const vec3< T > &up) |
Constructs a right-handed viewing transformation matrix and its inverse. More... | |
template<class T , std::size_t N, std::size_t M, std::size_t P> | |
constexpr matrix< T, P, M > | mul (const matrix< T, N, M > &a, const matrix< T, P, N > &b) noexcept |
Multiplies two matrices. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | mul (const matrix< T, N, M > &a, T b) noexcept |
Multiplies a matrix by a scalar. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M >::column_vector_type | mul (const matrix< T, N, M > &a, const typename matrix< T, N, M >::row_vector_type &b) noexcept |
Calculates the product of a matrix and a row vector. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M >::row_vector_type | mul (const typename matrix< T, N, M >::column_vector_type &a, const matrix< T, N, M > &b) noexcept |
Calculates the product of a column vector and a matrix. More... | |
template<class T > | |
mat3< T > | rotate (T angle, const vector< T, 3 > &axis) |
Constructs a rotation matrix. More... | |
template<class T > | |
mat3< T > | rotate_x (T angle) |
Produces a matrix which rotates Cartesian coordinates about the x-axis by a given angle. More... | |
template<class T > | |
mat3< T > | rotate_y (T angle) |
Produces a matrix which rotates Cartesian coordinates about the y-axis by a given angle. More... | |
template<class T > | |
mat3< T > | rotate_z (T angle) |
Produces a matrix which rotates Cartesian coordinates about the z-axis by a given angle. More... | |
template<class T > | |
constexpr mat4< T > | scale (const vec3< T > &v) |
Constructs a scale matrix. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | sub (const matrix< T, N, M > &a, const matrix< T, N, M > &b) noexcept |
Subtracts a matrix from another matrix. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | sub (const matrix< T, N, M > &a, T b) noexcept |
Subtracts a scalar from matrix. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M > | sub (T a, const matrix< T, N, M > &b) noexcept |
Subtracts a matrix from a scalar. More... | |
template<class T , std::size_t N> | |
constexpr T | trace (const matrix< T, N, N > &m) noexcept |
Calculates the trace of a square matrix. More... | |
template<class T > | |
constexpr mat4< T > | translate (const vec3< T > &v) |
Constructs a translation matrix. More... | |
template<class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, M, N > | transpose (const matrix< T, N, M > &m) noexcept |
Calculates the transpose of a matrix. More... | |
template<class T > | |
T | horizontal_fov (T v, T r) |
Calculates a horizontal FoV given a vertical FoV and aspect ratio. More... | |
template<class T > | |
T | vertical_fov (T h, T r) |
Calculates a vertical FoV given a horizontal FoV and aspect ratio. More... | |
template<class T > | |
constexpr mat4< T > | ortho (T left, T right, T bottom, T top, T near, T far) noexcept |
Constructs an orthographic projection matrix which will transform the near and far clipping planes to [-1, 1] , respectively. More... | |
template<class T > | |
constexpr std::tuple< mat4< T >, mat4< T > > | ortho_inv (T left, T right, T bottom, T top, T near, T far) noexcept |
Constructs an orthographic projection matrix which will transform the near and far clipping planes to [-1, 1] , respectively, along with its inverse. More... | |
template<class T > | |
constexpr mat4< T > | ortho_half_z (T left, T right, T bottom, T top, T near, T far) noexcept |
Constructs an orthographic projection matrix which will transform the near and far clipping planes to [0, 1] , respectively. More... | |
template<class T > | |
constexpr std::tuple< mat4< T >, mat4< T > > | ortho_half_z_inv (T left, T right, T bottom, T top, T near, T far) noexcept |
Constructs an orthographic projection matrix which will transform the near and far clipping planes to [0, 1] , respectively, along with its inverse. More... | |
template<class T > | |
mat4< T > | perspective (T vertical_fov, T aspect_ratio, T near, T far) |
Constructs a perspective projection matrix which will transform the near and far clipping planes to [-1, 1] , respectively. More... | |
template<class T > | |
std::tuple< mat4< T >, mat4< T > > | perspective_inv (T vertical_fov, T aspect_ratio, T near, T far) |
Constructs a perspective projection matrix which will transform the near and far clipping planes to [-1, 1] , respectively, along with its inverse. More... | |
template<class T > | |
mat4< T > | perspective_half_z (T vertical_fov, T aspect_ratio, T near, T far) |
Constructs a perspective projection matrix which will transform the near and far clipping planes to [0, 1] , respectively. More... | |
template<class T > | |
std::tuple< mat4< T >, mat4< T > > | perspective_half_z_inv (T vertical_fov, T aspect_ratio, T near, T far) |
Constructs a perspective projection matrix which will transform the near and far clipping planes to [0, 1] , respectively, along with its inverse. More... | |
template<class T > | |
mat4< T > | inf_perspective_half_z_reverse (T vertical_fov, T aspect_ratio, T near) |
Constructs a perspective projection matrix, with an infinite far plane, which will transform the near and far clipping planes to [1, 0] , respectively. More... | |
template<class T > | |
std::tuple< mat4< T >, mat4< T > > | inf_perspective_half_z_reverse_inv (T vertical_fov, T aspect_ratio, T near) |
Constructs a perspective projection matrix, with an infinite far plane, which will transform the near and far clipping planes to [1, 0] , respectively, along with its inverse. More... | |
template<class T > | |
constexpr quaternion< T > | add (const quaternion< T > &a, const quaternion< T > &b) noexcept |
Adds two quaternions. More... | |
template<class T > | |
constexpr quaternion< T > | add (const quaternion< T > &a, T b) noexcept |
Adds a quaternion and a scalar. More... | |
template<class T > | |
constexpr quaternion< T > | conjugate (const quaternion< T > &q) noexcept |
Calculates the conjugate of a quaternion. More... | |
template<class T > | |
constexpr T | dot (const quaternion< T > &a, const quaternion< T > &b) noexcept |
Calculates the dot product of two quaternions. More... | |
template<class T > | |
constexpr quaternion< T > | div (const quaternion< T > &a, const quaternion< T > &b) noexcept |
Divides a quaternion by another quaternion. More... | |
template<class T > | |
constexpr quaternion< T > | div (const quaternion< T > &a, T b) noexcept |
Divides a quaternion by a scalar. More... | |
template<class T > | |
constexpr quaternion< T > | div (T a, const quaternion< T > &b) noexcept |
Divides a scalar by a quaternion. More... | |
template<class T > | |
T | inv_length (const quaternion< T > &q) |
Calculates the inverse length of a quaternion. More... | |
template<class T > | |
T | length (const quaternion< T > &q) |
Calculates the length of a quaternion. More... | |
template<class T > | |
constexpr quaternion< T > | lerp (const quaternion< T > &a, const quaternion< T > &b, T t) noexcept |
Performs linear interpolation between two quaternions. More... | |
template<class T > | |
quaternion< T > | look_rotation (const vec3< T > &forward, vec3< T > up) |
Creates a unit quaternion rotation using forward and up vectors. More... | |
template<class T > | |
constexpr quaternion< T > | mul (const quaternion< T > &a, const quaternion< T > &b) noexcept |
Multiplies two quaternions. More... | |
template<class T > | |
constexpr quaternion< T > | mul (const quaternion< T > &a, T b) noexcept |
Multiplies a quaternion by a scalar. More... | |
template<class T > | |
constexpr vec3< T > | mul (const quaternion< T > &q, const vec3< T > &v) noexcept |
Rotates a vector by a unit quaternion. More... | |
template<class T > | |
constexpr vec3< T > | mul (const vec3< T > &v, const quaternion< T > &q) noexcept |
Rotates a vector by the inverse of a unit quaternion. More... | |
template<class T > | |
constexpr quaternion< T > | negate (const quaternion< T > &q) noexcept |
Negates a quaternion. More... | |
template<class T > | |
quaternion< T > | nlerp (const quaternion< T > &a, const quaternion< T > &b, T t) |
Performs normalized linear interpolation between two quaternions. More... | |
template<class T > | |
quaternion< T > | normalize (const quaternion< T > &q) |
Normalizes a quaternion. More... | |
template<class T > | |
quaternion< T > | angle_axis (T angle, const vec3< T > &axis) |
Creates a rotation from an angle and axis. More... | |
template<class T > | |
quaternion< T > | rotation (const vec3< T > &from, const vec3< T > &to, T tolerance=T{1e-6}) |
Constructs a quaternion representing the minimum rotation from one direction to another direction. More... | |
template<class T > | |
quaternion< T > | rotate_towards (const vec3< T > &from, const vec3< T > &to, T max_angle) |
Constructs a quaternion representing an angle-limited rotation from one direction towards another direction. More... | |
template<class T > | |
quaternion< T > | slerp (const quaternion< T > &a, const quaternion< T > &b, T t, T tolerance=T{1e-6}) |
Performs spherical linear interpolation between two quaternions. More... | |
template<class T > | |
constexpr T | sqr_length (const quaternion< T > &q) noexcept |
Calculates the square length of a quaternion. More... | |
template<class T > | |
constexpr quaternion< T > | sub (const quaternion< T > &a, const quaternion< T > &b) noexcept |
Subtracts a quaternion from another quaternion. More... | |
template<class T > | |
std::array< quaternion< T >, 2 > | swing_twist (const quaternion< T > &q, const vec3< T > &twist_axis, T tolerance=T{1e-6}) |
Decomposes a quaternion into swing and twist rotation components. More... | |
template<class T > | |
quaternion< T > | quaternion_cast (const mat3< T > &m) |
Converts a 3x3 rotation matrix to a quaternion. More... | |
template<typename T = float> | |
T | random (T start, T end) |
Generates a pseudo-random floating point number on [start, end) using std::rand(). More... | |
template<class T > | |
transform< T > | inverse (const transform< T > &t) noexcept |
Calculates the inverse of a transform. More... | |
template<class T > | |
transform< T > | mul (const transform< T > &x, const transform< T > &y) |
Combines two transforms. More... | |
template<class T > | |
constexpr vector< T, 3 > | mul (const transform< T > &t, const vector< T, 3 > &v) noexcept |
Transforms a vector by a transform. More... | |
template<class T > | |
constexpr vector< T, 3 > | mul (const vector< T, 3 > &v, const transform< T > &t) noexcept |
Transforms a vector by the inverse of a transform. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | abs (const vector< T, N > &x) |
Returns the absolute values of each element. More... | |
template<std::size_t N> | |
constexpr bool | all (const vector< bool, N > &x) noexcept |
Checks if all elements of a boolean vector are true . More... | |
template<std::floating_point T, std::size_t N> | |
T | angle (const vector< T, N > &from, const vector< T, N > &to) |
Calculates the angle between two direction vectors. More... | |
template<std::size_t N> | |
constexpr bool | any (const vector< bool, N > &x) noexcept |
Checks if any elements of a boolean vector are true . More... | |
template<std::floating_point T, std::size_t N> | |
constexpr vector< T, N > | ceil (const vector< T, N > &x) |
Performs an element-wise ceil operation. More... | |
template<std::floating_point T, std::size_t N> | |
vector< T, N > | clamp_length (const vector< T, N > &x, T max_length) |
Clamps the length of a vector. More... | |
template<class T > | |
constexpr vector< T, 3 > | cross (const vector< T, 3 > &x, const vector< T, 3 > &y) noexcept |
Calculates the cross product of two vectors. More... | |
template<std::floating_point T, std::size_t N> | |
T | distance (const vector< T, N > &p0, const vector< T, N > &p1) |
Calculates the distance between two points. More... | |
template<class T , std::size_t N> | |
constexpr T | dot (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Calculates the dot product of two vectors. More... | |
template<class T , std::size_t N> | |
constexpr vector< bool, N > | equal (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Compares two vectors for equality. More... | |
template<std::floating_point T, std::size_t N> | |
constexpr vector< T, N > | floor (const vector< T, N > &x) |
Performs a element-wise floor operation. More... | |
template<std::floating_point T, std::size_t N> | |
constexpr vector< T, N > | fract (const vector< T, N > &x) |
Returns a vector containing the fractional part of each element. More... | |
template<class T , std::size_t N> | |
constexpr vector< bool, N > | greater_than (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Performs a element-wise greater-than comparison of two vectors. More... | |
template<class T , std::size_t N> | |
constexpr vector< bool, N > | greater_than_equal (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Performs a element-wise greater-than or equal-to comparison of two vectors. More... | |
template<std::floating_point T, std::size_t N> | |
T | inv_length (const vector< T, N > &x) |
Calculates the inverse length of a vector. More... | |
template<std::floating_point T, std::size_t N> | |
T | length (const vector< T, N > &x) |
Calculates the length of a vector. More... | |
template<class T , std::size_t N> | |
constexpr vector< bool, N > | less_than (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Performs a element-wise less-than comparison of two vectors. More... | |
template<class T , std::size_t N> | |
constexpr vector< bool, N > | less_than_equal (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Performs a element-wise less-than or equal-to comparison of two vectors. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | max (const vector< T, N > &x, const vector< T, N > &y) |
Returns a vector containing the maximum elements of two vectors. More... | |
template<class T , std::size_t N> | |
constexpr T | max (const vector< T, N > &x) |
Returns the value of the greatest element in a vector. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | min (const vector< T, N > &x, const vector< T, N > &y) |
Returns a vector containing the minimum elements of two vectors. More... | |
template<class T , std::size_t N> | |
constexpr T | min (const vector< T, N > &x) |
Returns the value of the smallest element in a vector. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | negate (const vector< T, N > &x) noexcept |
Negates a vector. More... | |
template<std::floating_point T, std::size_t N> | |
vector< T, N > | normalize (const vector< T, N > &x) |
Calculates the unit vector in the same direction as the original vector. More... | |
template<class T , std::size_t N> | |
constexpr vector< bool, N > | logical_not (const vector< T, N > &x) noexcept |
Logically inverts a boolean vector. More... | |
template<class T , std::size_t N> | |
constexpr vector< bool, N > | not_equal (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Compares two vectors for inequality. More... | |
template<std::floating_point T, std::size_t N> | |
constexpr vector< T, N > | round (const vector< T, N > &x) |
Performs a element-wise round operation. More... | |
template<std::floating_point T, std::size_t N> | |
constexpr vector< T, N > | sign (const vector< T, N > &x) |
Returns a vector containing the signs of each element. More... | |
template<std::floating_point T> | |
T | signed_angle (const vector< T, 3 > &x, const vector< T, 3 > &y, const vector< T, 3 > &n) |
Calculates the signed angle between two direction vectors about axis. More... | |
template<class T , std::size_t N> | |
constexpr T | sqr_distance (const vector< T, N > &p0, const vector< T, N > &p1) noexcept |
Calculates the square distance between two points. More... | |
template<class T , std::size_t N> | |
constexpr T | sqr_length (const vector< T, N > &x) noexcept |
Calculates the square length of a vector. More... | |
template<std::floating_point T, std::size_t N> | |
vector< T, N > | sqrt (const vector< T, N > &x) |
Takes the square root of each element. More... | |
template<class T , std::size_t N> | |
constexpr T | sum (const vector< T, N > &x) noexcept |
Calculates the sum of all elements in a vector. More... | |
template<std::size_t... Indices, class T , std::size_t N> | |
constexpr vector< T, sizeof...(Indices)> | swizzle (const vector< T, N > &x) noexcept |
Makes an m-dimensional vector by rearranging and/or duplicating elements of an n-dimensional vector. More... | |
template<class T > | |
constexpr T | triple (const vector< T, 3 > &x, const vector< T, 3 > &y, const vector< T, 3 > &z) noexcept |
Calculates the triple product of three vectors. More... | |
template<std::floating_point T, std::size_t N> | |
constexpr vector< T, N > | trunc (const vector< T, N > &x) |
Performs a element-wise trunc operation. More... | |
template<std::floating_point T, std::size_t N> | |
vector< T, N > | sqrt (const vector< T, N > &x, const vector< T, N > &y) |
template<rotation_sequence Sequence, class T > | |
vec3< T > | euler_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_zxz_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_xyx_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_yzy_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_zyz_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_xzx_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_yxy_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_xyz_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_yzx_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_zxy_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_xzy_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_zyx_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_yxz_from_quat (const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<class T > | |
vec3< T > | euler_from_quat (rotation_sequence sequence, const quat< T > &q, T tolerance=T{1e-6}) |
Derives Euler angles from a unit quaternion. More... | |
template<rotation_sequence Sequence, class T > | |
quat< T > | euler_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_zxz_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_xyx_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_yzy_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_zyz_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_xzx_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_yxy_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_xyz_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_yzx_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_zxy_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_xzy_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_zyx_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_yxz_to_quat (const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<class T > | |
quat< T > | euler_to_quat (rotation_sequence sequence, const vec3< T > &angles) |
Constructs a quaternion from Euler angles. More... | |
template<std::size_t I, class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M >::column_vector_type & | get (matrix< T, N, M > &m) noexcept |
Extracts the Ith column from a matrix. More... | |
template<std::size_t I, class T , std::size_t N, std::size_t M> | |
constexpr matrix< T, N, M >::column_vector_type && | get (matrix< T, N, M > &&m) noexcept |
Extracts the Ith column from a matrix. More... | |
template<std::size_t I, class T , std::size_t N, std::size_t M> | |
constexpr const matrix< T, N, M >::column_vector_type & | get (const matrix< T, N, M > &m) noexcept |
Extracts the Ith column from a matrix. More... | |
template<std::size_t I, class T , std::size_t N, std::size_t M> | |
constexpr const matrix< T, N, M >::column_vector_type && | get (const matrix< T, N, M > &&m) noexcept |
Extracts the Ith column from a matrix. More... | |
template<class T > | |
constexpr quaternion< T > | sub (const quaternion< T > &a, T b) noexcept |
Subtracts a quaternion and a scalar. More... | |
template<class T > | |
constexpr quaternion< T > | sub (T a, const quaternion< T > &b) noexcept |
Subtracts a quaternion and a scalar. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | add (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Adds two values. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | add (const vector< T, N > &x, T y) noexcept |
Adds two values. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | clamp (const vector< T, N > &x, const vector< T, N > &min, const vector< T, N > &max) |
Clamps the values of a vector's elements. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | clamp (const vector< T, N > &x, T min, T max) |
Clamps the values of a vector's elements. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | div (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Divides a vector by a value. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | div (const vector< T, N > &x, T y) noexcept |
Divides a vector by a value. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | div (T x, const vector< T, N > &y) noexcept |
Divides a vector by a value. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | fma (const vector< T, N > &x, const vector< T, N > &y, const vector< T, N > &z) |
Performs a multiply-add operation. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | fma (const vector< T, N > &x, T y, T z) |
Performs a multiply-add operation. More... | |
template<std::size_t I, class T , std::size_t N> | |
constexpr T & | get (math::vector< T, N > &v) noexcept |
Extracts the Ith element from a vector. More... | |
template<std::size_t I, class T , std::size_t N> | |
constexpr T && | get (math::vector< T, N > &&v) noexcept |
Extracts the Ith element from a vector. More... | |
template<std::size_t I, class T , std::size_t N> | |
constexpr const T & | get (const math::vector< T, N > &v) noexcept |
Extracts the Ith element from a vector. More... | |
template<std::size_t I, class T , std::size_t N> | |
constexpr const T && | get (const math::vector< T, N > &&v) noexcept |
Extracts the Ith element from a vector. More... | |
template<std::floating_point T, std::size_t N> | |
constexpr vector< T, N > | mod (const vector< T, N > &x, const vector< T, N > &y) |
Calculates the element-wise remainder of the division operation x / y . More... | |
template<std::floating_point T, std::size_t N> | |
constexpr vector< T, N > | mod (const vector< T, N > &x, T y) |
Calculates the element-wise remainder of the division operation x / y . More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | mul (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Multiplies two values. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | mul (const vector< T, N > &x, T y) noexcept |
Multiplies two values. More... | |
template<std::floating_point T, std::size_t N> | |
vector< T, N > | pow (const vector< T, N > &x, const vector< T, N > &y) |
Raises each element to a power. More... | |
template<std::floating_point T, std::size_t N> | |
vector< T, N > | pow (const vector< T, N > &x, T y) |
Raises each element to a power. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | sub (const vector< T, N > &x, const vector< T, N > &y) noexcept |
Subtracts a value by another value. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | sub (const vector< T, N > &x, T y) noexcept |
Subtracts a value by another value. More... | |
template<class T , std::size_t N> | |
constexpr vector< T, N > | sub (T x, const vector< T, N > &y) noexcept |
Subtracts a value by another value. More... | |
Mathematical functions and data types.
|
strong |
Rotation sequences of proper Euler and Tait-Bryan angles.
Indices of the first, second, and third rotation axes are encoded in bits 0-1, 2-3, and 4-5, respectively.
Definition at line 38 of file euler-angles.hpp.
|
inlineconstexpr |
Returns the absolute values of each element.
x | Input vector. |
Definition at line 985 of file vector.hpp.
|
constexprnoexcept |
Adds two matrices.
a | First matrix. |
b | Second matrix. |
Definition at line 776 of file math/matrix.hpp.
|
constexprnoexcept |
Adds a matrix and a scalar.
a | Matrix. |
b | scalar. |
Definition at line 789 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Adds two quaternions.
a | First quaternion. |
b | Second quaternion. |
Definition at line 554 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Adds a quaternion and a scalar.
a | First value. |
b | Second second value. |
Definition at line 560 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Adds two values.
x | First value. |
y | Second value. |
Definition at line 998 of file vector.hpp.
|
inlineconstexprnoexcept |
Adds two values.
x | First value. |
y | Second value. |
Definition at line 1011 of file vector.hpp.
|
inlineconstexprnoexcept |
Checks if all elements of a boolean vector are true
.
x | Vector to be tested for truth. |
true
if all elements are true
, false
otherwise. Definition at line 1024 of file vector.hpp.
T math::angle | ( | const vector< T, N > & | from, |
const vector< T, N > & | to | ||
) |
Calculates the angle between two direction vectors.
from | First direction vector. |
to | Second direction vector. |
Definition at line 1030 of file vector.hpp.
quaternion< T > math::angle_axis | ( | T | angle, |
const vec3< T > & | axis | ||
) |
Creates a rotation from an angle and axis.
angle | Angle of rotation (in radians). |
axis | Axis of rotation |
Definition at line 685 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Checks if any elements of a boolean vector are true
.
x | Vector to be tested for truth. |
true
if any elements are true
, false
otherwise. Definition at line 1043 of file vector.hpp.
|
inlineconstexpr |
Performs an element-wise ceil operation.
x | Input vector. |
Definition at line 1056 of file vector.hpp.
|
inlineconstexpr |
Clamps the values of a vector's elements.
x | Vector to clamp. |
min | Minimum value. |
max | Maximum value. |
Definition at line 1069 of file vector.hpp.
|
inlineconstexpr |
Clamps the values of a vector's elements.
x | Vector to clamp. |
min | Minimum value. |
max | Maximum value. |
Definition at line 1082 of file vector.hpp.
vector< T, N > math::clamp_length | ( | const vector< T, N > & | x, |
T | max_length | ||
) |
Clamps the length of a vector.
x | Vector to clamp. |
max_length | Maximum length. |
Definition at line 1088 of file vector.hpp.
|
constexprnoexcept |
Performs a component-wise multiplication of two matrices.
x | First matrix multiplicand. |
y | Second matrix multiplicand. |
Definition at line 843 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Calculates the conjugate of a quaternion.
q | Quaternion from which the conjugate will be calculated. |
Definition at line 566 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Calculates the cross product of two vectors.
x | First vector. |
y | Second vector. |
Definition at line 1095 of file vector.hpp.
|
inlineconstexprnoexcept |
Converts an angle from radians to degrees.
radians | Angle in radians. |
Definition at line 36 of file angles.hpp.
|
constexprnoexcept |
Calculates the determinant of a square matrix.
m | Matrix of which to take the determinant. |
m
.
|
inline |
Calculates the distance between two points.
p0 | First of two points. |
p1 | Second of two points. |
Definition at line 1106 of file vector.hpp.
|
constexprnoexcept |
Divides a matrix by a matrix.
a | First matrix. |
b | Second matrix. |
Definition at line 856 of file math/matrix.hpp.
|
constexprnoexcept |
Divides a matrix by a scalar.
a | Matrix. |
b | Scalar. |
Definition at line 869 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Divides a quaternion by another quaternion.
a | First value. |
b | Second value. |
Definition at line 578 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Divides a quaternion by a scalar.
a | Quaternion. |
b | Scalar. |
Definition at line 584 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Divides a vector by a value.
x | First value. |
y | Second value. |
Definition at line 1119 of file vector.hpp.
|
inlineconstexprnoexcept |
Divides a vector by a value.
x | First value. |
y | Second value. |
Definition at line 1132 of file vector.hpp.
|
constexprnoexcept |
Divides a scalar by a matrix.
a | Scalar. |
b | Matrix. |
Definition at line 882 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Divides a scalar by a quaternion.
a | Scalar. |
b | Quaternion. |
Definition at line 590 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Divides a vector by a value.
x | First value. |
y | Second value. |
Definition at line 1145 of file vector.hpp.
|
inlineconstexprnoexcept |
Calculates the dot product of two quaternions.
a | First quaternion. |
b | Second quaternion. |
Definition at line 572 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Calculates the dot product of two vectors.
x | First vector. |
y | Second vector. |
Definition at line 1158 of file vector.hpp.
|
inlineconstexprnoexcept |
Compares two vectors for equality.
x | First vector. |
y | Second vector. |
Definition at line 1171 of file vector.hpp.
vec3<T> math::euler_from_quat | ( | const quat< T > & | q, |
T | tolerance = T{1e-6} |
||
) |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 109 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 235 of file euler-angles.hpp.
quat<T> math::euler_to_quat | ( | const vec3< T > & | angles | ) |
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 283 of file euler-angles.hpp.
|
inline |
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 488 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 169 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 422 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 199 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 452 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 187 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 440 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 217 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 470 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 193 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 446 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 229 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 482 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 205 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 458 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 175 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 428 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 211 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 464 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 163 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 416 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 223 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 476 of file euler-angles.hpp.
|
inline |
Derives Euler angles from a unit quaternion.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
sequence | Rotation sequence of the Euler angles. |
q | Quaternion to convert. |
tolerance | Floating-point tolerance, in radians, for handling singularities. |
Definition at line 181 of file euler-angles.hpp.
Constructs a quaternion from Euler angles.
Sequence | Rotation sequence of the Euler angles. |
T | Scalar type. |
angles | Vector of Euler angles. |
Definition at line 434 of file euler-angles.hpp.
|
inlineconstexpr |
Performs a element-wise floor operation.
x | Input vector. |
Definition at line 1184 of file vector.hpp.
|
inlineconstexpr |
Performs a multiply-add operation.
x | Input vector |
y | Value to multiply. |
z | Value to add. |
Definition at line 1197 of file vector.hpp.
|
inlineconstexpr |
Performs a multiply-add operation.
x | Input vector |
y | Value to multiply. |
z | Value to add. |
Definition at line 1210 of file vector.hpp.
|
inlineconstexpr |
Returns a vector containing the fractional part of each element.
x | Input vector. |
Definition at line 1223 of file vector.hpp.
|
inline |
|
inlineconstexprnoexcept |
Extracts the Ith element from a vector.
I | Index of an element. |
T | Element type. |
N | Number of elements. |
v | Vector from which to extract an element. |
v
. Definition at line 1250 of file vector.hpp.
|
inlineconstexprnoexcept |
Extracts the Ith element from a vector.
I | Index of an element. |
T | Element type. |
N | Number of elements. |
v | Vector from which to extract an element. |
v
. Definition at line 1243 of file vector.hpp.
|
inlineconstexprnoexcept |
Extracts the Ith column from a matrix.
I | Index of a column. |
T | Element type. |
N | Number of columns. |
M | Number of rows. |
m | Matrix from which to extract a column. |
m
. Definition at line 909 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Extracts the Ith column from a matrix.
I | Index of a column. |
T | Element type. |
N | Number of columns. |
M | Number of rows. |
m | Matrix from which to extract a column. |
m
. Definition at line 902 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Extracts the Ith element from a vector.
I | Index of an element. |
T | Element type. |
N | Number of elements. |
v | Vector from which to extract an element. |
v
. Definition at line 1236 of file vector.hpp.
|
inlineconstexprnoexcept |
Extracts the Ith element from a vector.
I | Index of an element. |
T | Element type. |
N | Number of elements. |
v | Vector from which to extract an element. |
v
. Definition at line 1229 of file vector.hpp.
|
inlineconstexprnoexcept |
Extracts the Ith column from a matrix.
I | Index of a column. |
T | Element type. |
N | Number of columns. |
M | Number of rows. |
m | Matrix from which to extract a column. |
m
. Definition at line 895 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Extracts the Ith column from a matrix.
I | Index of a column. |
T | Element type. |
N | Number of columns. |
M | Number of rows. |
m | Matrix from which to extract a column. |
m
. Definition at line 888 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Performs a element-wise greater-than comparison of two vectors.
x | First vector. |
y | Second vector. |
Definition at line 1264 of file vector.hpp.
|
inlineconstexprnoexcept |
Performs a element-wise greater-than or equal-to comparison of two vectors.
x | First vector. |
y | Second vector. |
Definition at line 1277 of file vector.hpp.
T math::horizontal_fov | ( | T | v, |
T | r | ||
) |
Calculates a horizontal FoV given a vertical FoV and aspect ratio.
v | Vertical FoV, in radians. |
r | Ratio of width to height. |
Definition at line 40 of file math/projection.hpp.
mat4<T> math::inf_perspective_half_z_reverse | ( | T | vertical_fov, |
T | aspect_ratio, | ||
T | near | ||
) |
Constructs a perspective projection matrix, with an infinite far plane, which will transform the near and far clipping planes to [1, 0]
, respectively.
vertical_fov | Vertical field of view angle, in radians. |
aspect_ratio | Aspect ratio which determines the horizontal field of view. |
near | Distance to the near clipping plane. |
Definition at line 319 of file math/projection.hpp.
std::tuple<mat4<T>, mat4<T> > math::inf_perspective_half_z_reverse_inv | ( | T | vertical_fov, |
T | aspect_ratio, | ||
T | near | ||
) |
Constructs a perspective projection matrix, with an infinite far plane, which will transform the near and far clipping planes to [1, 0]
, respectively, along with its inverse.
vertical_fov | Vertical field of view angle, in radians. |
aspect_ratio | Aspect ratio which determines the horizontal field of view. |
near | Distance to the near clipping plane. |
Definition at line 345 of file math/projection.hpp.
|
inline |
Calculates the inverse length of a quaternion.
q | Quaternion to calculate the inverse length of. |
Definition at line 596 of file quaternion.hpp.
|
inline |
Calculates the inverse length of a vector.
x | Vector of which to calculate the inverse length. |
Definition at line 1283 of file vector.hpp.
|
constexprnoexcept |
Calculates the inverse of a square matrix.
m | Square matrix. |
m
.Calculates the inverse of a transform.
t | Transform of which to take the inverse. |
Definition at line 155 of file transform.hpp.
|
inline |
Calculates the length of a quaternion.
q | Quaternion to calculate the length of. |
Definition at line 602 of file quaternion.hpp.
|
inline |
Calculates the length of a vector.
x | Vector of which to calculate the length. |
Definition at line 1289 of file vector.hpp.
|
inlineconstexprnoexcept |
Performs linear interpolation between two quaternions.
a | First quaternion. |
b | Second quaternion. |
t | Interpolation factor. |
Definition at line 608 of file quaternion.hpp.
|
constexprnoexcept |
Linearly interpolates between x
and y
.
Requires the following operators to be defined:
T operator+(const T&, const T&); T operator-(const T&, const T&); T operator*(const T&, S);
T | Value type. |
S | Scalar type. |
Definition at line 41 of file interpolation.hpp.
|
constexpr |
Linearly interpolates between two angles, x
and y
.
T | Value type. |
x | Start angle, in radians. |
y | End angle, in radians. |
a | Interpolation ratio. |
Definition at line 56 of file interpolation.hpp.
|
inlineconstexprnoexcept |
Performs a element-wise less-than comparison of two vectors.
x | First vector. |
y | Second vector. |
Definition at line 1302 of file vector.hpp.
|
inlineconstexprnoexcept |
Performs a element-wise less-than or equal-to comparison of two vectors.
x | First vector. |
y | Second vector. |
Definition at line 1315 of file vector.hpp.
T math::log_lerp | ( | const T & | x, |
const T & | y, | ||
S | a | ||
) |
Logarithmically interpolates between x
and y
.
x
is zero.T | Value type. |
S | Scalar type. |
Definition at line 70 of file interpolation.hpp.
|
inlineconstexprnoexcept |
Logically inverts a boolean vector.
x | Vector to be inverted. |
Definition at line 1437 of file vector.hpp.
|
constexpr |
Constructs a right-handed viewing transformation matrix.
position | Position of the view point. |
target | Position of the target. |
up | Unit vector pointing in the up direction. |
Definition at line 983 of file math/matrix.hpp.
|
constexpr |
Constructs a right-handed viewing transformation matrix and its inverse.
position | Position of the view point. |
target | Position of the target. |
up | Unit vector pointing in the up direction. |
Definition at line 1000 of file math/matrix.hpp.
quaternion< T > math::look_rotation | ( | const vec3< T > & | forward, |
vec3< T > | up | ||
) |
Creates a unit quaternion rotation using forward and up vectors.
forward | Unit forward vector. |
up | Unit up vector. |
Definition at line 618 of file quaternion.hpp.
|
constexprnoexcept |
|
inlineconstexpr |
Returns the value of the greatest element in a vector.
x | Input vector. |
Definition at line 1334 of file vector.hpp.
|
constexpr |
Returns a vector containing the maximum elements of two vectors.
x | First vector. |
y | Second vector. |
Definition at line 1328 of file vector.hpp.
|
inlineconstexpr |
Returns the value of the smallest element in a vector.
x | Input vector. |
Definition at line 1353 of file vector.hpp.
|
constexpr |
Returns a vector containing the minimum elements of two vectors.
x | First vector. |
y | Second vector. |
Definition at line 1347 of file vector.hpp.
|
inlineconstexpr |
Calculates the element-wise remainder of the division operation x / y
.
x | First vector. |
y | Second vector. |
x / y
. Definition at line 1366 of file vector.hpp.
|
inlineconstexpr |
Calculates the element-wise remainder of the division operation x / y
.
x | First vector. |
y | Second vector. |
x / y
. Definition at line 1379 of file vector.hpp.
|
constexprnoexcept |
Multiplies two matrices.
T | Matrix element type. |
N | Number of columns in matrix a , and rows in matrix b . |
M | Number of rows in matrix a . |
P | Number of columns in matrix b . |
a | First matrix. |
b | Second matrix. |
a * b
. Definition at line 1027 of file math/matrix.hpp.
|
constexprnoexcept |
Calculates the product of a matrix and a row vector.
a | Matrix. |
b | Row vector |
Definition at line 1066 of file math/matrix.hpp.
|
constexprnoexcept |
Multiplies a matrix by a scalar.
a | Matrix. |
b | Scalar. |
Definition at line 1053 of file math/matrix.hpp.
|
constexprnoexcept |
Multiplies two quaternions.
a | First quaternion. |
b | Second quaternion. |
Definition at line 635 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Multiplies a quaternion by a scalar.
a | First value. |
b | Second value. |
Definition at line 647 of file quaternion.hpp.
|
constexprnoexcept |
Rotates a vector by a unit quaternion.
q | Unit quaternion. |
v | Vector to rotate. |
q
must be a unit quaternion.Definition at line 653 of file quaternion.hpp.
|
constexprnoexcept |
Transforms a vector by a transform.
t | Transform. |
v | Vector. |
Definition at line 172 of file transform.hpp.
Combines two transforms.
x | First transform. |
y | Second transform. |
Definition at line 161 of file transform.hpp.
|
constexprnoexcept |
Calculates the product of a column vector and a matrix.
a | Column vector. |
b | Matrix. |
Definition at line 1079 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Rotates a vector by the inverse of a unit quaternion.
v | Vector to rotate. |
q | Unit quaternion. |
q
must be a unit quaternion. Definition at line 660 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Transforms a vector by the inverse of a transform.
v | Vector. |
t | Transform. |
Definition at line 178 of file transform.hpp.
|
inlineconstexprnoexcept |
Multiplies two values.
x | First value. |
y | Second value. |
Definition at line 1392 of file vector.hpp.
|
inlineconstexprnoexcept |
Multiplies two values.
x | First value. |
y | Second value. |
Definition at line 1405 of file vector.hpp.
|
inlineconstexprnoexcept |
Negates a quaternion.
q | Quaternion to negate. |
Definition at line 667 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Negates a vector.
x | Vector to negate. |
Definition at line 1418 of file vector.hpp.
quaternion< T > math::nlerp | ( | const quaternion< T > & | a, |
const quaternion< T > & | b, | ||
T | t | ||
) |
Performs normalized linear interpolation between two quaternions.
a | First quaternion. |
b | Second quaternion. |
t | Interpolation factor. |
Definition at line 673 of file quaternion.hpp.
|
inline |
Normalizes a quaternion.
q | Quaternion to normalize. |
Definition at line 679 of file quaternion.hpp.
|
inline |
Calculates the unit vector in the same direction as the original vector.
x | Vector to normalize. |
Definition at line 1424 of file vector.hpp.
|
inlineconstexprnoexcept |
Compares two vectors for inequality.
x | First vector. |
y | Second vector. |
Definition at line 1450 of file vector.hpp.
|
constexprnoexcept |
Constructs an orthographic projection matrix which will transform the near and far clipping planes to [-1, 1]
, respectively.
left | Signed distance to the left clipping plane. |
right | Signed distance to the right clipping plane. |
bottom | Signed distance to the bottom clipping plane. |
top | Signed distance to the top clipping plane. |
near | Signed distance to the near clipping plane. |
far | Signed distance to the far clipping plane. |
Definition at line 74 of file math/projection.hpp.
|
constexprnoexcept |
Constructs an orthographic projection matrix which will transform the near and far clipping planes to [0, 1]
, respectively.
left | Signed distance to the left clipping plane. |
right | Signed distance to the right clipping plane. |
bottom | Signed distance to the bottom clipping plane. |
top | Signed distance to the top clipping plane. |
near | Signed distance to the near clipping plane. |
far | Signed distance to the far clipping plane. |
Definition at line 135 of file math/projection.hpp.
|
constexprnoexcept |
Constructs an orthographic projection matrix which will transform the near and far clipping planes to [0, 1]
, respectively, along with its inverse.
left | Signed distance to the left clipping plane. |
right | Signed distance to the right clipping plane. |
bottom | Signed distance to the bottom clipping plane. |
top | Signed distance to the top clipping plane. |
near | Signed distance to the near clipping plane. |
far | Signed distance to the far clipping plane. |
Definition at line 161 of file math/projection.hpp.
|
constexprnoexcept |
Constructs an orthographic projection matrix which will transform the near and far clipping planes to [-1, 1]
, respectively, along with its inverse.
left | Signed distance to the left clipping plane. |
right | Signed distance to the right clipping plane. |
bottom | Signed distance to the bottom clipping plane. |
top | Signed distance to the top clipping plane. |
near | Signed distance to the near clipping plane. |
far | Signed distance to the far clipping plane. |
Definition at line 100 of file math/projection.hpp.
mat4<T> math::perspective | ( | T | vertical_fov, |
T | aspect_ratio, | ||
T | near, | ||
T | far | ||
) |
Constructs a perspective projection matrix which will transform the near and far clipping planes to [-1, 1]
, respectively.
vertical_fov | Vertical field of view angle, in radians. |
aspect_ratio | Aspect ratio which determines the horizontal field of view. |
near | Distance to the near clipping plane. |
far | Distance to the far clipping plane. |
Definition at line 194 of file math/projection.hpp.
mat4<T> math::perspective_half_z | ( | T | vertical_fov, |
T | aspect_ratio, | ||
T | near, | ||
T | far | ||
) |
Constructs a perspective projection matrix which will transform the near and far clipping planes to [0, 1]
, respectively.
vertical_fov | Vertical field of view angle, in radians. |
aspect_ratio | Aspect ratio which determines the horizontal field of view. |
near | Distance to the near clipping plane. |
far | Distance to the far clipping plane. |
Definition at line 257 of file math/projection.hpp.
std::tuple<mat4<T>, mat4<T> > math::perspective_half_z_inv | ( | T | vertical_fov, |
T | aspect_ratio, | ||
T | near, | ||
T | far | ||
) |
Constructs a perspective projection matrix which will transform the near and far clipping planes to [0, 1]
, respectively, along with its inverse.
vertical_fov | Vertical field of view angle, in radians. |
aspect_ratio | Aspect ratio which determines the horizontal field of view. |
near | Distance to the near clipping plane. |
far | Distance to the far clipping plane. |
Definition at line 284 of file math/projection.hpp.
std::tuple<mat4<T>, mat4<T> > math::perspective_inv | ( | T | vertical_fov, |
T | aspect_ratio, | ||
T | near, | ||
T | far | ||
) |
Constructs a perspective projection matrix which will transform the near and far clipping planes to [-1, 1]
, respectively, along with its inverse.
vertical_fov | Vertical field of view angle, in radians. |
aspect_ratio | Aspect ratio which determines the horizontal field of view. |
near | Distance to the near clipping plane. |
far | Distance to the far clipping plane. |
Definition at line 221 of file math/projection.hpp.
|
inline |
Raises each element to a power.
x | Input vector |
y | Exponent. |
Definition at line 1463 of file vector.hpp.
|
inline |
Raises each element to a power.
x | Input vector |
y | Exponent. |
Definition at line 1476 of file vector.hpp.
quaternion< T > math::quaternion_cast | ( | const mat3< T > & | m | ) |
Converts a 3x3 rotation matrix to a quaternion.
m | Rotation matrix. |
m
. Definition at line 803 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Converts an angle given in degrees to radians.
radians | Angle in radians. |
Definition at line 48 of file angles.hpp.
T math::random | ( | T | start, |
T | end | ||
) |
Generates a pseudo-random floating point number on [start, end)
using std::rand().
start | Start of the range (inclusive). |
end | End of the range (exclusive). |
Definition at line 38 of file random.hpp.
Constructs a rotation matrix.
angle | Angle of rotation, in radians. |
axis | Axis of rotation. |
Definition at line 1085 of file math/matrix.hpp.
quaternion< T > math::rotate_towards | ( | const vec3< T > & | from, |
const vec3< T > & | to, | ||
T | max_angle | ||
) |
Constructs a quaternion representing an angle-limited rotation from one direction towards another direction.
from | Unit vector pointing in the source direction. |
to | Unit vector pointing in the target direction. |
max_angle | Maximum angle of rotation, in radians. |
from
towards direction to
.from
and to
must be unit vectors. Definition at line 716 of file quaternion.hpp.
mat3< T > math::rotate_x | ( | T | angle | ) |
Produces a matrix which rotates Cartesian coordinates about the x-axis by a given angle.
angle | Angle of rotation, in radians. |
Definition at line 1106 of file math/matrix.hpp.
mat3< T > math::rotate_y | ( | T | angle | ) |
Produces a matrix which rotates Cartesian coordinates about the y-axis by a given angle.
angle | Angle of rotation, in radians. |
Definition at line 1120 of file math/matrix.hpp.
mat3< T > math::rotate_z | ( | T | angle | ) |
Produces a matrix which rotates Cartesian coordinates about the z-axis by a given angle.
angle | Angle of rotation, in radians. |
Definition at line 1134 of file math/matrix.hpp.
quaternion< T > math::rotation | ( | const vec3< T > & | from, |
const vec3< T > & | to, | ||
T | tolerance = T{1e-6} |
||
) |
Constructs a quaternion representing the minimum rotation from one direction to another direction.
from | Unit vector pointing in the source direction. |
to | Unit vector pointing in the target direction. |
tolerance | Floating-point tolerance. |
from
to direction to
.from
and to
must be unit vectors. Definition at line 691 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Returns the indices of the axes of a rotation sequence.
T | Index type. |
sequence | Rotation sequence. |
sequence
. Definition at line 87 of file euler-angles.hpp.
|
inlineconstexpr |
Performs a element-wise round operation.
x | Input vector |
Definition at line 1489 of file vector.hpp.
Constructs a scale matrix.
v | Scale vector. |
Definition at line 1148 of file math/matrix.hpp.
|
inlineconstexpr |
Returns a vector containing the signs of each element.
x | Input vector |
Definition at line 1502 of file vector.hpp.
T math::signed_angle | ( | const vector< T, 3 > & | x, |
const vector< T, 3 > & | y, | ||
const vector< T, 3 > & | n | ||
) |
Calculates the signed angle between two direction vectors about axis.
from | First direction vector. |
to | Second direction vector. |
axis | Axis direction vector. |
from
and to
about axis
, in radians. Definition at line 1508 of file vector.hpp.
quaternion< T > math::slerp | ( | const quaternion< T > & | a, |
const quaternion< T > & | b, | ||
T | t, | ||
T | tolerance = T{1e-6} |
||
) |
Performs spherical linear interpolation between two quaternions.
a | First quaternion. |
b | Second quaternion. |
t | Interpolation factor. |
tolerance | Floating-point tolerance. |
Definition at line 724 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Calculates the square distance between two points.
The square distance can be calculated faster than the distance because a call to std::sqrt
is saved.
p0 | First of two points. |
p1 | Second of two points. |
Definition at line 1514 of file vector.hpp.
|
inlineconstexprnoexcept |
Calculates the square length of a quaternion.
The square length can be calculated faster than the length because a call to std::sqrt
is saved.
q | Quaternion to calculate the square length of. |
Definition at line 744 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Calculates the square length of a vector.
The square length can be calculated faster than the length because a call to std::sqrt
is saved.
x | Vector of which to calculate the square length. |
Definition at line 1520 of file vector.hpp.
Takes the square root of each element.
x | Input vector |
|
inline |
Definition at line 1533 of file vector.hpp.
|
constexprnoexcept |
Subtracts a matrix from another matrix.
a | First matrix. |
b | Second matrix. |
Definition at line 1167 of file math/matrix.hpp.
|
constexprnoexcept |
Subtracts a scalar from matrix.
a | Matrix. |
b | Scalar. |
Definition at line 1180 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Subtracts a quaternion from another quaternion.
a | First quaternion. |
b | Second quaternion. |
Definition at line 750 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Subtracts a quaternion and a scalar.
a | First value. |
b | Second second. |
Definition at line 756 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Subtracts a value by another value.
x | First value. |
y | Second value. |
Definition at line 1546 of file vector.hpp.
|
inlineconstexprnoexcept |
Subtracts a value by another value.
x | First value. |
y | Second value. |
Definition at line 1559 of file vector.hpp.
|
constexprnoexcept |
Subtracts a matrix from a scalar.
a | Scalar. |
b | Matrix. |
Definition at line 1193 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Subtracts a quaternion and a scalar.
a | First value. |
b | Second second. |
Definition at line 762 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Subtracts a value by another value.
x | First value. |
y | Second value. |
Definition at line 1572 of file vector.hpp.
|
inlineconstexprnoexcept |
Calculates the sum of all elements in a vector.
x | Vector to sum. |
Definition at line 1585 of file vector.hpp.
std::array< quaternion< T >, 2 > math::swing_twist | ( | const quaternion< T > & | q, |
const vec3< T > & | twist_axis, | ||
T | tolerance = T{1e-6} |
||
) |
Decomposes a quaternion into swing and twist rotation components.
[in] | q | Unit quaternion to decompose. |
[in] | twist_axis | Axis of twist rotation. |
[out] | swing | Swing rotation component. |
[out] | twist | Twist rotation component. |
[in] | tolerance | Floating-point tolerance. |
q
must be a unit quaternion. twist_axis
must be a unit vector.Definition at line 768 of file quaternion.hpp.
|
inlineconstexprnoexcept |
Makes an m-dimensional vector by rearranging and/or duplicating elements of an n-dimensional vector.
Indices | List of indices of elements in x . |
T | Vector element type. |
N | Number of dimensions in x . |
x | Vector to swizzle. |
x
in the order specified by Indices
. The size of the returned vector is equivalent to the number of indices in Indices
. Definition at line 1591 of file vector.hpp.
|
constexprnoexcept |
Calculates the trace of a square matrix.
m | Square matrix. |
Definition at line 1206 of file math/matrix.hpp.
Constructs a translation matrix.
v | Translation vector. |
Definition at line 1212 of file math/matrix.hpp.
|
constexprnoexcept |
Calculates the transpose of a matrix.
m | Matrix to transpose. |
Definition at line 1238 of file math/matrix.hpp.
|
inlineconstexprnoexcept |
Calculates the triple product of three vectors.
x | First vector. |
y | Second vector. |
z | Third vector. |
dot(x, cross(y, z)
). Definition at line 1597 of file vector.hpp.
|
inlineconstexpr |
Performs a element-wise trunc operation.
x | Input vector |
Definition at line 1610 of file vector.hpp.
T math::vertical_fov | ( | T | h, |
T | r | ||
) |
Calculates a vertical FoV given a horizontal FoV and aspect ratio.
h | Horizontal FoV, in radians. |
r | Ratio of width to height. |
Definition at line 56 of file math/projection.hpp.
|
inlineconstexpr |
Wraps an angle to [-180, 180].
degrees | Angle in degrees. |
Definition at line 60 of file angles.hpp.
|
inlineconstexpr |
Wraps an angle to [-pi, pi].
radians | Angle in radians. |
Definition at line 72 of file angles.hpp.