Unravel Engine C++ Reference
|
General purpose transformation class designed to maintain each component of the transformation separate (translation, rotation, scale and shear) whilst providing much of the same functionality provided by standard matrices. More...
#include <transform.hpp>
Public Types | |
using | mat3_t = mat<3, 3, T, Q> |
using | mat4_t = mat<4, 4, T, Q> |
using | vec2_t = vec<2, T, Q> |
using | vec3_t = vec<3, T, Q> |
using | vec4_t = vec<4, T, Q> |
using | quat_t = qua<T, Q> |
using | length_t = typename mat4_t::length_type |
using | col_t = typename mat4_t::col_type |
Public Member Functions | |
transform_t ()=default | |
Default constructor. | |
~transform_t ()=default | |
transform_t (const transform_t &t) noexcept=default | |
Copy constructor. | |
transform_t (transform_t &&t) noexcept=default | |
Move constructor. | |
auto | operator= (const transform_t &m) noexcept -> transform_t &=default |
Copy assignment operator. | |
auto | operator= (transform_t &&m) noexcept -> transform_t &=default |
Move assignment operator. | |
transform_t (const mat4_t &m) noexcept | |
Constructor from a 4x4 matrix. | |
auto | get_position () const noexcept -> const vec3_t & |
Get the position component. | |
auto | get_translation () const noexcept -> const vec3_t & |
Get the translation component. | |
void | set_translation (const vec3_t &position) noexcept |
Set the translation component. | |
void | set_translation (T x, T y, T z=T(0)) noexcept |
Set the translation component. | |
void | reset_translation () noexcept |
Reset the translation component to zero. | |
void | set_position (const vec3_t &position) noexcept |
Set the position component. | |
void | set_position (T x, T y, T z=T(0)) noexcept |
Set the position component. | |
void | reset_position () noexcept |
Reset the position component to zero. | |
auto | get_rotation_euler () const noexcept -> vec3_t |
Get the rotation component as Euler angles. | |
auto | get_rotation_euler_degrees () const noexcept -> vec3_t |
Get the rotation component as Euler angles in degrees. | |
auto | get_rotation_euler_degrees (vec3_t hint) const noexcept -> vec3_t |
Get the rotation component as Euler angles in degrees with a hint. | |
void | set_rotation_euler (const vec3_t &euler_angles) noexcept |
Set the rotation component using Euler angles. | |
void | set_rotation_euler (T x, T y, T z) noexcept |
Set the rotation component using Euler angles. | |
void | set_rotation_euler_degrees (const vec3_t &euler_angles) noexcept |
Set the rotation component using Euler angles in degrees. | |
void | set_rotation_euler_degrees (T x, T y, T z) noexcept |
Set the rotation component using Euler angles in degrees. | |
auto | get_rotation () const noexcept -> const quat_t & |
Get the rotation component. | |
void | set_rotation (const quat_t &rotation) noexcept |
Set the rotation component. | |
void | set_rotation (const vec3_t &x, const vec3_t &y, const vec3_t &z) noexcept |
Set the rotation component using basis vectors. | |
void | reset_rotation () noexcept |
Reset the rotation component to identity. | |
auto | get_scale () const noexcept -> const vec3_t & |
Get the scale component. | |
void | set_scale (const vec3_t &scale) noexcept |
Set the scale component. | |
void | set_scale (T x, T y, T z=T(1)) noexcept |
Set the scale component. | |
void | reset_scale () noexcept |
Reset the scale component to one. | |
auto | get_skew () const noexcept -> const vec3_t & |
Get the skew component. | |
void | set_skew (const vec3_t &skew) noexcept |
Set the skew component. | |
void | set_skew (T x, T y, T z) noexcept |
Set the skew component. | |
void | reset_skew () noexcept |
Reset the skew component to zero. | |
auto | get_perspective () const noexcept -> const vec4_t & |
Get the perspective component. | |
void | set_perspective (const vec4_t &perspective) noexcept |
Set the perspective component. | |
void | set_perspective (T x, T y, T z, T w) noexcept |
Set the perspective component. | |
void | reset_perspective () noexcept |
Reset the perspective component to default. | |
auto | x_axis () const noexcept -> vec3_t |
Get the X axis of the transform. | |
auto | y_axis () const noexcept -> vec3_t |
Get the Y axis of the transform. | |
auto | z_axis () const noexcept -> vec3_t |
Get the Z axis of the transform. | |
auto | x_unit_axis () const noexcept -> vec3_t |
Get the unit X axis of the transform. | |
auto | y_unit_axis () const noexcept -> vec3_t |
Get the unit Y axis of the transform. | |
auto | z_unit_axis () const noexcept -> vec3_t |
Get the unit Z axis of the transform. | |
void | rotate_axis (T a, const vec3_t &v) noexcept |
Rotate the transform around an axis. | |
void | rotate (const quat_t &q) noexcept |
Rotate the transform using a quaternion. | |
void | rotate (T x, T y, T z) noexcept |
Rotate the transform using Euler angles. | |
void | rotate (const vec3_t &v) noexcept |
Rotate the transform using Euler angles. | |
void | rotate_local (T x, T y, T z) noexcept |
Rotate the transform locally using Euler angles. | |
void | rotate_local (const vec3_t &v) noexcept |
Rotate the transform locally using Euler angles. | |
void | scale (T x, T y, T z=T(1)) noexcept |
Scale the transform. | |
void | scale (const vec3_t &v) noexcept |
Scale the transform. | |
void | translate (T x, T y, T z=T(0)) noexcept |
Translate the transform. | |
void | translate (const vec3_t &v) noexcept |
Translate the transform. | |
void | translate_local (T x, T y, T z=T(0)) noexcept |
Translate the transform locally. | |
void | translate_local (const vec3_t &v) noexcept |
Translate the transform locally. | |
auto | compare (const transform_t &rhs) const noexcept -> int |
Compare this transform with another. | |
auto | compare (const transform_t &rhs, T tolerance) const noexcept -> int |
Compare this transform with another within a tolerance. | |
auto | transform_coord (const vec2_t &v) const noexcept -> vec2_t |
Transform a 2D coordinate. | |
auto | inverse_transform_coord (const vec2_t &v) const noexcept -> vec2_t |
Inverse transform a 2D coordinate. | |
auto | transform_normal (const vec2_t &v) const noexcept -> vec2_t |
Transform a 2D normal. | |
auto | inverse_transform_normal (const vec2_t &v) const noexcept -> vec2_t |
Inverse transform a 2D normal. | |
auto | transform_coord (const vec3_t &v) const noexcept -> vec3_t |
Transform a 3D coordinate. | |
auto | inverse_transform_coord (const vec3_t &v) const noexcept -> vec3_t |
Inverse transform a 3D coordinate. | |
auto | transform_normal (const vec3_t &v) const noexcept -> vec3_t |
Transform a 3D normal. | |
auto | inverse_transform_normal (const vec3_t &v) const noexcept -> vec3_t |
Inverse transform a 3D normal. | |
operator const mat4_t & () const noexcept | |
Implicit conversion to a constant reference to the transformation matrix. | |
operator const mat4_t * () const noexcept | |
Implicit conversion to a constant pointer to the transformation matrix. | |
operator const T * () const noexcept | |
Implicit conversion to a constant pointer to the transformation matrix data. | |
auto | operator* (const transform_t &t) const noexcept -> transform_t |
Multiply two transforms. | |
auto | operator== (const transform_t &t) const noexcept -> bool |
Compare two transforms for equality. | |
auto | operator!= (const transform_t &t) const noexcept -> bool |
Compare two transforms for inequality. | |
auto | operator[] (length_t i) const noexcept -> const col_t & |
Get a column of the transform matrix. | |
auto | operator* (const vec4_t &v) const noexcept -> vec4_t |
Transform a 4D vector. | |
auto | get_matrix () const noexcept -> const mat4_t & |
Get the transform matrix. | |
Static Public Member Functions | |
static auto | identity () noexcept -> const transform_t & |
Get the identity transform. | |
static auto | scaling (const vec2_t &scale) noexcept -> transform_t |
Create a scaling transform. | |
static auto | scaling (const vec3_t &scale) noexcept -> transform_t |
Create a scaling transform. | |
static auto | rotation (const quat_t &rotation) noexcept -> transform_t |
Create a rotation transform. | |
static auto | rotation_euler (const vec3_t &euler_angles) noexcept -> transform_t |
Create a rotation transform from Euler angles. | |
static auto | translation (const vec2_t &trans) noexcept -> transform_t |
Create a translation transform. | |
static auto | translation (const vec3_t &trans) noexcept -> transform_t |
Create a translation transform. | |
General purpose transformation class designed to maintain each component of the transformation separate (translation, rotation, scale and shear) whilst providing much of the same functionality provided by standard matrices.
Definition at line 26 of file transform.hpp.
using math::transform_t< T, Q >::col_t = typename mat4_t::col_type |
Definition at line 36 of file transform.hpp.
using math::transform_t< T, Q >::length_t = typename mat4_t::length_type |
Definition at line 35 of file transform.hpp.
using math::transform_t< T, Q >::mat3_t = mat<3, 3, T, Q> |
Definition at line 29 of file transform.hpp.
using math::transform_t< T, Q >::mat4_t = mat<4, 4, T, Q> |
Definition at line 30 of file transform.hpp.
using math::transform_t< T, Q >::quat_t = qua<T, Q> |
Definition at line 34 of file transform.hpp.
using math::transform_t< T, Q >::vec2_t = vec<2, T, Q> |
Definition at line 31 of file transform.hpp.
using math::transform_t< T, Q >::vec3_t = vec<3, T, Q> |
Definition at line 32 of file transform.hpp.
using math::transform_t< T, Q >::vec4_t = vec<4, T, Q> |
Definition at line 33 of file transform.hpp.
|
default |
Default constructor.
|
default |
|
defaultnoexcept |
Copy constructor.
|
defaultnoexcept |
Move constructor.
|
noexcept |
Constructor from a 4x4 matrix.
Definition at line 743 of file transform.hpp.
|
noexcept |
Compare this transform with another.
t | The transform to compare with. |
Definition at line 1109 of file transform.hpp.
|
noexcept |
Compare this transform with another within a tolerance.
t | The transform to compare with. |
tolerance | The tolerance value. |
Definition at line 1115 of file transform.hpp.
|
noexcept |
Get the transform matrix.
Definition at line 1384 of file transform.hpp.
|
noexcept |
Get the perspective component.
Definition at line 947 of file transform.hpp.
|
noexcept |
Get the position component.
Definition at line 753 of file transform.hpp.
|
noexcept |
Get the rotation component.
Definition at line 933 of file transform.hpp.
|
noexcept |
Get the rotation component as Euler angles.
Definition at line 804 of file transform.hpp.
|
noexcept |
Get the rotation component as Euler angles in degrees.
Definition at line 810 of file transform.hpp.
|
noexcept |
Get the rotation component as Euler angles in degrees with a hint.
hint | The hint vector for calculating the Euler angles. |
Definition at line 818 of file transform.hpp.
|
noexcept |
Get the scale component.
Definition at line 860 of file transform.hpp.
|
noexcept |
Get the skew component.
Definition at line 940 of file transform.hpp.
|
noexcept |
Get the translation component.
Definition at line 760 of file transform.hpp.
|
staticnoexcept |
Get the identity transform.
Definition at line 1292 of file transform.hpp.
|
noexcept |
Inverse transform a 2D coordinate.
v | The 2D vector to inverse transform. |
Definition at line 1187 of file transform.hpp.
|
noexcept |
Inverse transform a 3D coordinate.
v | The 3D vector to inverse transform. |
Definition at line 1223 of file transform.hpp.
|
noexcept |
Inverse transform a 2D normal.
v | The 2D normal to inverse transform. |
Definition at line 1201 of file transform.hpp.
|
noexcept |
Inverse transform a 3D normal.
v | The 3D normal to inverse transform. |
Definition at line 1274 of file transform.hpp.
|
noexcept |
Implicit conversion to a constant reference to the transformation matrix.
Allows the transform to be used wherever a constant reference to a mat4_t is expected.
|
noexcept |
Implicit conversion to a constant pointer to the transformation matrix.
Allows the transform to be used wherever a constant pointer to a mat4_t is expected.
|
noexcept |
Implicit conversion to a constant pointer to the transformation matrix data.
Allows the transform to be used wherever a constant pointer to the underlying data is expected, facilitating interfacing with APIs that require raw matrix data.
Definition at line 1493 of file transform.hpp.
|
noexcept |
Compare two transforms for inequality.
t | The transform to compare with. |
Definition at line 1378 of file transform.hpp.
|
noexcept |
Multiply two transforms.
t | The transform to multiply by. |
Definition at line 1343 of file transform.hpp.
|
noexcept |
Transform a 4D vector.
v | The vector to transform. |
Definition at line 1486 of file transform.hpp.
|
defaultnoexcept |
Copy assignment operator.
|
defaultnoexcept |
Move assignment operator.
|
noexcept |
Compare two transforms for equality.
t | The transform to compare with. |
Definition at line 1372 of file transform.hpp.
|
noexcept |
Get a column of the transform matrix.
i | The column index. |
Definition at line 1480 of file transform.hpp.
|
noexcept |
Reset the perspective component to default.
Definition at line 927 of file transform.hpp.
|
noexcept |
Reset the position component to zero.
Definition at line 798 of file transform.hpp.
|
noexcept |
Reset the rotation component to identity.
Definition at line 969 of file transform.hpp.
|
noexcept |
Reset the scale component to one.
Definition at line 883 of file transform.hpp.
|
noexcept |
Reset the skew component to zero.
Definition at line 905 of file transform.hpp.
|
noexcept |
Reset the translation component to zero.
Definition at line 778 of file transform.hpp.
|
noexcept |
Rotate the transform using a quaternion.
q | The quaternion to rotate by. |
Definition at line 1029 of file transform.hpp.
|
noexcept |
Rotate the transform using Euler angles.
v | The Euler angles. |
Definition at line 1049 of file transform.hpp.
|
noexcept |
Rotate the transform using Euler angles.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 1043 of file transform.hpp.
|
noexcept |
Rotate the transform around an axis.
a | The angle to rotate. |
v | The axis to rotate around. |
Definition at line 1036 of file transform.hpp.
|
noexcept |
Rotate the transform locally using Euler angles.
v | The Euler angles. |
Definition at line 1063 of file transform.hpp.
|
noexcept |
Rotate the transform locally using Euler angles.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 1057 of file transform.hpp.
|
staticnoexcept |
Create a rotation transform.
rotation | The quaternion rotation. |
Definition at line 1313 of file transform.hpp.
|
staticnoexcept |
Create a rotation transform from Euler angles.
euler_angles | The Euler angles. |
Definition at line 1321 of file transform.hpp.
|
noexcept |
|
noexcept |
Scale the transform.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 1071 of file transform.hpp.
|
staticnoexcept |
Create a scaling transform.
scale | The scale vector. |
Definition at line 1299 of file transform.hpp.
|
staticnoexcept |
Create a scaling transform.
scale | The scale vector. |
Definition at line 1305 of file transform.hpp.
|
noexcept |
Set the perspective component.
perspective | The new perspective vector. |
Definition at line 911 of file transform.hpp.
|
noexcept |
Set the perspective component.
x | The X component. |
y | The Y component. |
z | The Z component. |
w | The W component. |
Definition at line 921 of file transform.hpp.
|
noexcept |
Set the position component.
position | The new position vector. |
Definition at line 784 of file transform.hpp.
|
noexcept |
Set the position component.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 792 of file transform.hpp.
|
noexcept |
Set the rotation component.
rotation | The quaternion rotation to set. |
Definition at line 954 of file transform.hpp.
|
noexcept |
Set the rotation component using basis vectors.
x | The X basis vector. |
y | The Y basis vector. |
z | The Z basis vector. |
Definition at line 962 of file transform.hpp.
|
noexcept |
Set the rotation component using Euler angles.
euler_angles | The Euler angles to set. |
Definition at line 836 of file transform.hpp.
|
noexcept |
Set the rotation component using Euler angles.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 842 of file transform.hpp.
|
noexcept |
Set the rotation component using Euler angles in degrees.
euler_angles | The Euler angles in degrees to set. |
Definition at line 848 of file transform.hpp.
|
noexcept |
Set the rotation component using Euler angles in degrees.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 854 of file transform.hpp.
|
noexcept |
Set the scale component.
scale | The new scale vector. |
Definition at line 867 of file transform.hpp.
|
noexcept |
Set the scale component.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 877 of file transform.hpp.
|
noexcept |
Set the skew component.
skew | The new skew vector. |
Definition at line 889 of file transform.hpp.
|
noexcept |
Set the skew component.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 899 of file transform.hpp.
|
noexcept |
Set the translation component.
position | The new translation vector. |
Definition at line 766 of file transform.hpp.
|
noexcept |
Set the translation component.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 772 of file transform.hpp.
|
noexcept |
Transform a 2D coordinate.
v | The 2D vector to transform. |
Definition at line 1180 of file transform.hpp.
|
noexcept |
Transform a 3D coordinate.
v | The 3D vector to transform. |
Definition at line 1208 of file transform.hpp.
|
noexcept |
Transform a 2D normal.
v | The 2D normal to transform. |
Definition at line 1194 of file transform.hpp.
|
noexcept |
Transform a 3D normal.
v | The 3D normal to transform. |
Definition at line 1252 of file transform.hpp.
|
noexcept |
Translate the transform.
v | The translation vector. |
Definition at line 1089 of file transform.hpp.
|
noexcept |
Translate the transform.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 1083 of file transform.hpp.
|
noexcept |
Translate the transform locally.
v | The translation vector. |
Definition at line 1101 of file transform.hpp.
|
noexcept |
Translate the transform locally.
x | The X component. |
y | The Y component. |
z | The Z component. |
Definition at line 1095 of file transform.hpp.
|
staticnoexcept |
Create a translation transform.
trans | The translation vector. |
Definition at line 1329 of file transform.hpp.
|
staticnoexcept |
Create a translation transform.
trans | The translation vector. |
Definition at line 1335 of file transform.hpp.
|
noexcept |
Get the X axis of the transform.
Definition at line 975 of file transform.hpp.
|
noexcept |
Get the unit X axis of the transform.
Definition at line 1011 of file transform.hpp.
|
noexcept |
Get the Y axis of the transform.
Definition at line 987 of file transform.hpp.
|
noexcept |
Get the unit Y axis of the transform.
Definition at line 1017 of file transform.hpp.
|
noexcept |
Get the Z axis of the transform.
Definition at line 999 of file transform.hpp.
|
noexcept |
Get the unit Z axis of the transform.
Definition at line 1023 of file transform.hpp.