Tuesday
Functions
<tue/transform.hpp>

Detailed Description

Functions for generating and converting between different types of transformations.

This library has a few different ways of representing 3-dimensional rotations specifically:

Functions

template<typename T >
vec4< decltype(tue::math::sin(std::declval< T >)))> tue::transform::axis_angle (const T &x, const T &y, const T &z) noexcept
 Converts a rotation vector to an axis-angle vector. More...
 
template<typename T >
vec4< decltype(tue::math::sin(std::declval< T >)))> tue::transform::axis_angle (const vec3< T > &v) noexcept
 Converts a rotation vector to an axis-angle vector. More...
 
template<typename T >
constexpr vec3< decltype(tue::math::sin(std::declval< T >)))> tue::transform::rotation_vec (const T &axis_x, const T &axis_y, const T &axis_z, const T &angle) noexcept
 Converts an axis-angle pair to a rotation vector. More...
 
template<typename T >
constexpr vec3< decltype(tue::math::sin(std::declval< T >)))> tue::transform::rotation_vec (const vec3< T > &axis, const T &angle) noexcept
 Converts an axis-angle pair to a rotation vector. More...
 
template<typename T >
constexpr vec3< decltype(tue::math::sin(std::declval< T >)))> tue::transform::rotation_vec (const vec4< T > &v) noexcept
 Converts an axis-angle vector to a rotation vector. More...
 
template<typename T >
quat< decltype(tue::math::sin(std::declval< T >)))> tue::transform::rotation_quat (const T &axis_x, const T &axis_y, const T &axis_z, const T &angle) noexcept
 Converts an axis-angle pair to a rotation quaternion. More...
 
template<typename T >
quat< decltype(tue::math::sin(std::declval< T >)))> tue::transform::rotation_quat (const vec3< T > &axis, const T &angle) noexcept
 Converts an axis-angle pair to a rotation quaternion. More...
 
template<typename T >
quat< decltype(tue::math::sin(std::declval< T >)))> tue::transform::rotation_quat (const vec4< T > &v) noexcept
 Converts an axis-angle vector to a rotation quaternion. More...
 
template<typename T >
quat< decltype(tue::math::sin(std::declval< T >)))> tue::transform::rotation_quat (const T &x, const T &y, const T &z) noexcept
 Converts a rotation vector to a rotation quaternion. More...
 
template<typename T >
quat< decltype(tue::math::sin(std::declval< T >)))> tue::transform::rotation_quat (const vec3< T > &v) noexcept
 Converts a rotation vector to a rotation quaternion. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >=2 &&R >=3), mat< T, C, R > > tue::transform::translation_mat (const T &x, const T &y) noexcept
 Computes a 2D translation matrix. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >=2 &&R >=3), mat< T, C, R > > tue::transform::translation_mat (const vec2< T > &v) noexcept
 Computes a 2D translation matrix. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >=3 &&R >=4), mat< T, C, R > > tue::transform::translation_mat (const T &x, const T &y, const T &z) noexcept
 Computes a 3D translation matrix. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >=3 &&R >=4), mat< T, C, R > > tue::transform::translation_mat (const vec3< T > &v) noexcept
 Computes a 3D translation matrix. More...
 
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >=2 &&R >=2), mat< decltype(tue::math::sin(std::declval< T >))), C, R > > tue::transform::rotation_mat (const T &angle) noexcept
 Computes a 2D rotation matrix. More...
 
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >=3 &&R >=3), mat< decltype(tue::math::sin(std::declval< T >))), C, R > > tue::transform::rotation_mat (const T &axis_x, const T &axis_y, const T &axis_z, const T &angle) noexcept
 Computes a 3D rotation matrix from an axis-angle pair. More...
 
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >=3 &&R >=3), mat< decltype(tue::math::sin(std::declval< T >))), C, R > > tue::transform::rotation_mat (const vec3< T > &axis, const T &angle) noexcept
 Computes a 3D rotation matrix from an axis-angle pair. More...
 
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >=3 &&R >=3), mat< decltype(tue::math::sin(std::declval< T >))), C, R > > tue::transform::rotation_mat (const vec4< T > &v) noexcept
 Computes a 3D rotation matrix from an axis-angle vector. More...
 
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >=3 &&R >=3), mat< decltype(tue::math::sin(std::declval< T >))), C, R > > tue::transform::rotation_mat (const T &x, const T &y, const T &z) noexcept
 Computes a 3D rotation matrix from a rotation vector. More...
 
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >=3 &&R >=3), mat< decltype(tue::math::sin(std::declval< T >))), C, R > > tue::transform::rotation_mat (const vec3< T > &v) noexcept
 Computes a 3D rotation matrix from a rotation vector. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t< (C >=3 &&R >=3), mat< decltype(tue::math::sin(std::declval< T >))), C, R > > tue::transform::rotation_mat (const quat< T > &q) noexcept
 Computes a 3D rotation matrix from a rotation quaternion. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >=2 &&R >=2), mat< T, C, R > > tue::transform::scale_mat (const T &x, const T &y) noexcept
 Computes a 2D scale matrix. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >=2 &&R >=2), mat< T, C, R > > tue::transform::scale_mat (const vec2< T > &v) noexcept
 Computes a 2D scale matrix. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >=3 &&R >=3), mat< T, C, R > > tue::transform::scale_mat (const T &x, const T &y, const T &z) noexcept
 Computes a 3D scale matrix. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >=3 &&R >=3), mat< T, C, R > > tue::transform::scale_mat (const vec3< T > &v) noexcept
 Computes a 3D scale matrix. More...
 
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >=4 &&R >=4), mat< decltype(tue::math::sin(std::declval< T >))), C, R > > tue::transform::perspective_mat (const T &fovy, const T &aspect, const T &n, const T &f) noexcept
 Computes a 3D perspective matrix. More...
 
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t< (C >=3 &&R >=4), mat< decltype(tue::math::recip(std::declval< T >))), C, R > > tue::transform::ortho_mat (const T &width, const T &height, const T &n, const T &f) noexcept
 Computes an orthographic projection matrix. More...
 

Function Documentation

template<typename T >
vec4<decltype(tue::math::sin(std::declval<T>)))> tue::transform::axis_angle ( const T &  x,
const T &  y,
const T &  z 
)
inlinenoexcept

Converts a rotation vector to an axis-angle vector.

If the rotation vector's length is 0, returns (0, 0, 1, 0).

Template Parameters
TThe rotation vector's component type.
Parameters
xThe rotation vector's first component.
yThe rotation vector's second component.
zThe rotation vector's third component.
Returns
The axis-angle vector.
template<typename T >
vec4<decltype(tue::math::sin(std::declval<T>)))> tue::transform::axis_angle ( const vec3< T > &  v)
inlinenoexcept

Converts a rotation vector to an axis-angle vector.

If the rotation vector's length is 0, returns (0, 0, 1, 0).

Template Parameters
TThe rotation vector's component type.
Parameters
vThe rotation vector.
Returns
The axis-angle vector.
template<typename T >
constexpr vec3<decltype(tue::math::sin(std::declval<T>)))> tue::transform::rotation_vec ( const T &  axis_x,
const T &  axis_y,
const T &  axis_z,
const T &  angle 
)
inlinenoexcept

Converts an axis-angle pair to a rotation vector.

This function assumes the axis is normalized.

Template Parameters
TThe axis-angle component type.
Parameters
axis_xThe axis' first component.
axis_yThe axis' second component.
axis_zThe axis' third component.
angleThe angle.
Returns
The rotation vector.
template<typename T >
constexpr vec3<decltype(tue::math::sin(std::declval<T>)))> tue::transform::rotation_vec ( const vec3< T > &  axis,
const T &  angle 
)
inlinenoexcept

Converts an axis-angle pair to a rotation vector.

This function assumes the axis is normalized.

Template Parameters
TThe axis-angle component type.
Parameters
axisThe axis.
angleThe angle.
Returns
The rotation vector.
template<typename T >
constexpr vec3<decltype(tue::math::sin(std::declval<T>)))> tue::transform::rotation_vec ( const vec4< T > &  v)
inlinenoexcept

Converts an axis-angle vector to a rotation vector.

This function assumes the axis is normalized.

Template Parameters
TThe axis-angle component type.
Parameters
vThe axis-angle vector.
Returns
The rotation vector.
template<typename T >
quat<decltype(tue::math::sin(std::declval<T>)))> tue::transform::rotation_quat ( const T &  axis_x,
const T &  axis_y,
const T &  axis_z,
const T &  angle 
)
inlinenoexcept

Converts an axis-angle pair to a rotation quaternion.

This function assumes the axis is normalized.

Template Parameters
TThe axis-angle component type.
Parameters
axis_xThe axis' first component.
axis_yThe axis' second component.
axis_zThe axis' third component.
angleThe angle.
Returns
The rotation quaternion.
template<typename T >
quat<decltype(tue::math::sin(std::declval<T>)))> tue::transform::rotation_quat ( const vec3< T > &  axis,
const T &  angle 
)
inlinenoexcept

Converts an axis-angle pair to a rotation quaternion.

This function assumes the axis is normalized.

Template Parameters
TThe axis-angle component type.
Parameters
axisThe axis.
angleThe angle.
Returns
The rotation quaternion.
template<typename T >
quat<decltype(tue::math::sin(std::declval<T>)))> tue::transform::rotation_quat ( const vec4< T > &  v)
inlinenoexcept

Converts an axis-angle vector to a rotation quaternion.

This function assumes the axis is normalized.

Template Parameters
TThe axis-angle component type.
Parameters
vThe axis-angle vector.
Returns
The rotation quaternion.
template<typename T >
quat<decltype(tue::math::sin(std::declval<T>)))> tue::transform::rotation_quat ( const T &  x,
const T &  y,
const T &  z 
)
inlinenoexcept

Converts a rotation vector to a rotation quaternion.

If the rotation vector's length is 0, returns (0, 0, 0, 1).

Template Parameters
TThe rotation vector's component type.
Parameters
xThe rotation vector's first component.
yThe rotation vector's second component.
zThe rotation vector's third component.
Returns
The rotation quaternion.
template<typename T >
quat<decltype(tue::math::sin(std::declval<T>)))> tue::transform::rotation_quat ( const vec3< T > &  v)
inlinenoexcept

Converts a rotation vector to a rotation quaternion.

If the rotation vector's length is 0, returns (0, 0, 0, 1).

Template Parameters
TThe rotation vector's component type.
Parameters
vThe rotation vector.
Returns
The rotation quaternion.
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >= 2 && R >= 3), mat<T, C, R> > tue::transform::translation_mat ( const T &  x,
const T &  y 
)
inlinenoexcept

Computes a 2D translation matrix.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe type of parameters x and y.
CThe column count of the returned matrix. Must be 2, 3, or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
xThe translation along the x axis.
yThe translation along the y axis.
Returns
A 2D translation matrix. Values beyond the requested matrix dimensions are truncated.
[ 1, 0, 0, 0 ]
[ 0, 1, 0, 0 ]
[ R == 3 ? x : 0, R == 3 ? y : 0, 1, 0 ]
[ R == 4 ? x : 0, R == 4 ? y : 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >= 2 && R >= 3), mat<T, C, R> > tue::transform::translation_mat ( const vec2< T > &  v)
inlinenoexcept

Computes a 2D translation matrix.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe component type of v.
CThe column count of the returned matrix. Must be 2, 3, or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
vThe translation vector.
Returns
A 2D translation matrix. Values beyond the requested matrix dimensions are truncated.
[ 1, 0, 0, 0 ]
[ 0, 1, 0, 0 ]
[ R == 3 ? v[0] : 0, R == 3 ? v[1] : 0, 1, 0 ]
[ R == 4 ? v[0] : 0, R == 4 ? v[1] : 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >= 3 && R >= 4), mat<T, C, R> > tue::transform::translation_mat ( const T &  x,
const T &  y,
const T &  z 
)
inlinenoexcept

Computes a 3D translation matrix.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe type of parameters x, y, and z.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 4. Defaults to 4.
Parameters
xThe translation along the x axis.
yThe translation along the y axis.
zThe translation along the z axis.
Returns
A 3D translation matrix. Values beyond the requested matrix dimensions are truncated.
[ 1, 0, 0, 0 ]
[ 0, 1, 0, 0 ]
[ 0, 0, 1, 0 ]
[ x, y, z, 1 ]
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >= 3 && R >= 4), mat<T, C, R> > tue::transform::translation_mat ( const vec3< T > &  v)
inlinenoexcept

Computes a 3D translation matrix.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe component type of v.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 4. Defaults to 4.
Parameters
vThe translation vector.
Returns
A 3D translation matrix. Values beyond the requested matrix dimensions are truncated.
[ 1 , 0 , 0 , 0 ]
[ 0 , 1 , 0 , 0 ]
[ 0 , 0 , 1 , 0 ]
[ v[0], v[1], v[2], 1 ]
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >= 2 && R >= 2), mat<decltype(tue::math::sin(std::declval<T>))), C, R> > tue::transform::rotation_mat ( const T &  angle)
inlinenoexcept

Computes a 2D rotation matrix.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe type of parameter angle.
CThe column count of the returned matrix. Must be 2, 3, or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 2, 3, or 4. Defaults to 4.
Parameters
angleThe rotation (measured in radians counter-clockwise).
Returns
A 2D rotation matrix. Values beyond the requested matrix dimensions are truncated.
[ cos(angle), sin(angle), 0, 0 ]
[ -sin(angle), cos(angle), 0, 0 ]
[ 0, 0, 1, 0 ]
[ 0, 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >= 3 && R >= 3), mat<decltype(tue::math::sin(std::declval<T>))), C, R> > tue::transform::rotation_mat ( const T &  axis_x,
const T &  axis_y,
const T &  axis_z,
const T &  angle 
)
inlinenoexcept

Computes a 3D rotation matrix from an axis-angle pair.

This function assumes the axis is normalized.
The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe axis-angle component type.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
axis_xThe axis' first component.
axis_yThe axis' second component.
axis_zThe axis' third component.
angleThe angle.
Returns
A 3D rotation matrix. Values beyond the requested matrix dimensions are truncated.
// Where x, y, and z make the axis of rotation
// and s and c are sin(angle) and cos(angle).
[ xx(1-c) + c, xy(1-c) + zs, xz(1-c) - ys, 0 ]
[ xy(1-c) - zs, yy(1-c) + c, yz(1-c) - xs, 0 ]
[ xz(1-c) + ys, yz(1-c) - xs, zz(1-c) + c, 0 ]
[ 0, 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >= 3 && R >= 3), mat<decltype(tue::math::sin(std::declval<T>))), C, R> > tue::transform::rotation_mat ( const vec3< T > &  axis,
const T &  angle 
)
inlinenoexcept

Computes a 3D rotation matrix from an axis-angle pair.

This function assumes the axis is normalized.
The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe axis-angle component type.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
axisThe axis.
angleThe angle.
Returns
A 3D rotation matrix. Values beyond the requested matrix dimensions are truncated.
// Where x, y, and z make the axis of rotation
// and s and c are sin(angle) and cos(angle).
[ xx(1-c) + c, xy(1-c) + zs, xz(1-c) - ys, 0 ]
[ xy(1-c) - zs, yy(1-c) + c, yz(1-c) - xs, 0 ]
[ xz(1-c) + ys, yz(1-c) - xs, zz(1-c) + c, 0 ]
[ 0, 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >= 3 && R >= 3), mat<decltype(tue::math::sin(std::declval<T>))), C, R> > tue::transform::rotation_mat ( const vec4< T > &  v)
inlinenoexcept

Computes a 3D rotation matrix from an axis-angle vector.

This function assumes the axis is normalized.
The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe axis-angle component type.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
vThe axis-angle vector.
Returns
A 3D rotation matrix. Values beyond the requested matrix dimensions are truncated.
// Where x, y, and z make the axis of rotation
// and s and c are sin(v[3]) and cos(v[3]).
[ xx(1-c) + c, xy(1-c) + zs, xz(1-c) - ys, 0 ]
[ xy(1-c) - zs, yy(1-c) + c, yz(1-c) - xs, 0 ]
[ xz(1-c) + ys, yz(1-c) - xs, zz(1-c) + c, 0 ]
[ 0, 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >= 3 && R >= 3), mat<decltype(tue::math::sin(std::declval<T>))), C, R> > tue::transform::rotation_mat ( const T &  x,
const T &  y,
const T &  z 
)
inlinenoexcept

Computes a 3D rotation matrix from a rotation vector.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe rotation vector's component type.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
xThe rotation vector's first component.
yThe rotation vector's second component.
zThe rotation vector's third component.
Returns
A 3D rotation matrix.
return tue::transform::rotation_mat<T, C, R>(
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >= 3 && R >= 3), mat<decltype(tue::math::sin(std::declval<T>))), C, R> > tue::transform::rotation_mat ( const vec3< T > &  v)
inlinenoexcept

Computes a 3D rotation matrix from a rotation vector.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe rotation vector's component type.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
vThe rotation vector.
Returns
A 3D rotation matrix.
return tue::transform::rotation_mat<T, C, R>(
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t< (C >= 3 && R >= 3), mat<decltype(tue::math::sin(std::declval<T>))), C, R> > tue::transform::rotation_mat ( const quat< T > &  q)
inlinenoexcept

Computes a 3D rotation matrix from a rotation quaternion.

This function assumes the quaternion is normalized.
The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe rotation quaternion's component type.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
qThe rotation quaternion.
Returns
A 3D rotation matrix. Values beyond the requested matrix dimensions are truncated.
// Where x, y, z, and w are the components of the rotation
// quaternion.
[ 1 - 2yy - 2zz, 2xy + 2zw, 2xz - 2yw, 0 ]
[ 2xy - 2zw, 1 - 2xx - 2zz, 2yz + 2xw, 0 ]
[ 2xz + 2yw, 2yz - 2xw, 1 - 2xx - 2yy, 0 ]
[ 0, 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >= 2 && R >= 2), mat<T, C, R> > tue::transform::scale_mat ( const T &  x,
const T &  y 
)
inlinenoexcept

Computes a 2D scale matrix.

Template Parameters
TThe type of parameters x and y.
CThe column count of the returned matrix. Must be 2, 3, or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 2, 3, or 4. Defaults to 4.
Parameters
xThe scale along the x axis.
yThe scale along the y axis.
Returns
A 2D scale matrix. Values beyond the requested matrix dimensions are truncated.
[ x, 0, 0, 0 ]
[ 0, y, 0, 0 ]
[ 0, 0, 1, 0 ]
[ 0, 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >= 2 && R >= 2), mat<T, C, R> > tue::transform::scale_mat ( const vec2< T > &  v)
inlinenoexcept

Computes a 2D scale matrix.

Template Parameters
TThe component type of v.
CThe column count of the returned matrix. Must be 2, 3, or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 2, 3, or 4. Defaults to 4.
Parameters
vThe scale vector.
Returns
A 2D scale matrix. Values beyond the requested matrix dimensions are truncated.
[ v[0], 0 , 0, 0 ]
[ 0 , v[1], 0, 0 ]
[ 0 , 0 , 1, 0 ]
[ 0 , 0 , 0, 1 ]
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >= 3 && R >= 3), mat<T, C, R> > tue::transform::scale_mat ( const T &  x,
const T &  y,
const T &  z 
)
inlinenoexcept

Computes a 3D scale matrix.

Template Parameters
TThe type of parameters x, y, and z.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
xThe scale along the x axis.
yThe scale along the y axis.
zThe scale along the z axis.
Returns
A 3D scale matrix. Values beyond the requested matrix dimensions are truncated.
[ x, 0, 0, 0 ]
[ 0, y, 0, 0 ]
[ 0, 0, z, 0 ]
[ 0, 0, 0, 1 ]
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t<(C >= 3 && R >= 3), mat<T, C, R> > tue::transform::scale_mat ( const vec3< T > &  v)
inlinenoexcept

Computes a 3D scale matrix.

Template Parameters
TThe component type of v.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 3 or 4. Defaults to 4.
Parameters
vThe scale vector.
Returns
A 3D scale matrix. Values beyond the requested matrix dimensions are truncated.
[ v[0], 0 , 0 , 0 ]
[ 0 , v[1], 0 , 0 ]
[ 0 , 0 , v[2], 0 ]
[ 0 , 0 , 0 , 1 ]
template<typename T , int C = 4, int R = 4>
std::enable_if_t< (C >= 4 && R >= 4), mat<decltype(tue::math::sin(std::declval<T>))), C, R> > tue::transform::perspective_mat ( const T &  fovy,
const T &  aspect,
const T &  n,
const T &  f 
)
inlinenoexcept

Computes a 3D perspective matrix.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe type of all four parameters.
CThe column count of the returned matrix. Must be 4. Defaults to 4.
RThe row count of the returned matrix. Must be 4. Defaults to 4.
Parameters
fovyThe vertical field of view (measured in radians).
aspectThe aspect ratio (width / height).
nThe distance to the near view plane.
fThe distance to the far view plane.
Returns
A 3D perspective matrix.
// Where s and c are sin(fovy/2) and cos(fovy/2)
[ c/s/aspect, 0, 0, 0 ]
[ 0, c/s, 0, 0 ]
[ 0, 0, (n+f)/(n-f), -1 ]
[ 0, 0, (2nf)/(n-f), 0 ]
template<typename T , int C = 4, int R = 4>
constexpr std::enable_if_t< (C >= 3 && R >= 4), mat<decltype(tue::math::recip(std::declval<T>))), C, R> > tue::transform::ortho_mat ( const T &  width,
const T &  height,
const T &  n,
const T &  f 
)
inlinenoexcept

Computes an orthographic projection matrix.

The returned matrix might be the transpose of what you expect from other libraries. This library generally prefers compound transformations be written from left-to-right instead of right-to-left.

Template Parameters
TThe type of all four parameters.
CThe column count of the returned matrix. Must be 3 or 4. Defaults to 4.
RThe row count of the returned matrix. Must be 4. Defaults to 4.
Parameters
widthThe orthographic projection width.
heightThe orthographic projection height.
nThe distance to the near view plane.
fThe distance to the far view plane.
Returns
An orthographic projection matrix.
[ 2/width, 0, 0, 0 ]
[ 0, 2/height, 0, 0 ]
[ 0, 0, (2)/(n-f), 0 ]
[ 0, 0, (n+f)/(n-f), 1 ]