rtm/types.h¶
#include "rtm/types.h"
quatf¶
A quaternion (4D complex number) where the imaginary part is the [w] component. It accurately represents a 3D rotation with no gimbal lock as long as it is kept normalized.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
quatd¶
A quaternion (4D complex number) where the imaginary part is the [w] component. It accurately represents a 3D rotation with no gimbal lock as long as it is kept normalized.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
vector4f¶
A 4D vector.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
vector4d¶
A 4D vector.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
mask4f¶
A 4x32 bit vector comparison mask for 32 bit floats: ~0 if true, 0 otherwise.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
mask4d¶
A 4x64 bit vector comparison mask for 64 bit floats: ~0 if true, 0 otherwise.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
mask4i¶
A 4x32 bit vector comparison mask: ~0 if true, 0 otherwise.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
mask4q¶
A 4x64 bit vector comparison mask: ~0 if true, 0 otherwise.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
scalarf¶
A SIMD friendly scalar type. Different architectures have an easier or harder time working with scalar floating point numbers. For example, older PowerPC processors had to write to memory and reload from it to transfer from one register file into another (e.g convert from a float to a SIMD vector). Modern processors handle this much better but inefficiencies remain, especially with SSE. While it is free to convert a SIMD scalar into a float with _mm_cvtss_f32(..) the reverse generally requires the compiler to fill the unused SIMD lanes with known values (either zero or the same). This introduces an extra instruction that isn't always required when only the first lane is used such as with scalar_sqrt_reciprocal(..). By introducing a type for SIMD scalar values, each platform is free to make an optimal choice.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
scalard¶
A SIMD friendly scalar type. Different architectures have an easier or harder time working with scalar floating point numbers. For example, older PowerPC processors had to write to memory and reload from it to transfer from one register file into another (e.g convert from a float to a SIMD vector). Modern processors handle this much better but inefficiencies remain, especially with SSE. While it is free to convert a SIMD scalar into a float with _mm_cvtss_f32(..) the reverse generally requires the compiler to fill the unused SIMD lanes with known values (either zero or the same). This introduces an extra instruction that isn't always required when only the first lane is used such as with scalar_sqrt_reciprocal(..). By introducing a type for SIMD scalar values, each platform is free to make an optimal choice.
The definition of this type depends on the SIMD code path. Use the functions of RTM to read and write its values.
vqf¶
struct vqf
{
quatf rotation; // The rotation part.
vector4f translation; // The translation part. The [w] component is undefined.
};
A VQ transform represents a 3D rotation (quaternion) and a 3D translation (vector). VQ transforms form a group with a well defined multiplication and inverse.
vqd¶
struct vqd
{
quatd rotation; // The rotation part.
vector4d translation; // The translation part. The [w] component is undefined.
};
A VQ transform represents a 3D rotation (quaternion) and a 3D translation (vector). VQ transforms form a group with a well defined multiplication and inverse.
qvf¶
using qvf = vqf;
The previous name of vqf.
Deprecated
Use 'vqf' instead. To be removed in 2.5.
qvd¶
using qvd = vqd;
The previous name of vqd.
Deprecated
Use 'vqd' instead. To be removed in 2.5.
vqsf¶
struct vqsf
{
quatf rotation; // The rotation part.
vector4f translation_scale; // The translation part in [xyz] and the scale part in [w].
};
A VQS transform represents a 3D rotation (quaternion), a 3D translation (vector), and a single scalar uniform scale value. VQS transforms form a group with a well defined multiplication and inverse.
vqsd¶
struct vqsd
{
quatd rotation; // The rotation part.
vector4d translation_scale; // The translation part in [xyz] and the scale part in [w].
};
A VQS transform represents a 3D rotation (quaternion), a 3D translation (vector), and a single scalar uniform scale value. VQS transforms form a group with a well defined multiplication and inverse.
qvsf¶
using qvsf = vqsf;
The previous name of vqsf.
Deprecated
Use 'vqsf' instead. To be removed in 2.5.
qvsd¶
using qvsd = vqsd;
The previous name of vqsd.
Deprecated
Use 'vqsd' instead. To be removed in 2.5.
vqvf¶
struct vqvf
{
quatf rotation; // The rotation part.
vector4f translation; // The translation part. The [w] component is undefined.
vector4f scale; // The scale part. The [w] component is undefined.
};
A VQV transform represents a 3D rotation (quaternion), 3D translation (vector), and 3D non-uniform scale (vector). WARNING: VQV transforms do NOT form a group. It has no well defined multiplication and inverse. This is because when non-uniform scale is rotated (e.g. as the result of two VQV multiplying), shear is introduced and there is no place to store it. As such, VQV discards the introduced shear which is mathematically incorrect. As a result of this, VQV multiplication is NOT associative and the inverse is incorrect. USE AT YOUR OWN RISK.
vqvd¶
struct vqvd
{
quatd rotation; // The rotation part.
vector4d translation; // The translation part. The [w] component is undefined.
vector4d scale; // The scale part. The [w] component is undefined.
};
A VQV transform represents a 3D rotation (quaternion), 3D translation (vector), and 3D non-uniform scale (vector). WARNING: VQV transforms do NOT form a group. It has no well defined multiplication and inverse. This is because when non-uniform scale is rotated (e.g. as the result of two VQV multiplying), shear is introduced and there is no place to store it. As such, VQV discards the introduced shear which is mathematically incorrect. As a result of this, VQV multiplication is NOT associative and the inverse is incorrect. USE AT YOUR OWN RISK.
qvvf¶
using qvvf = vqvf;
The previous name of vqvf.
Deprecated
Use 'vqvf' instead. To be removed in 2.5.
qvvd¶
using qvvd = vqvd;
The previous name of vqvd.
Deprecated
Use 'vqvd' instead. To be removed in 2.5.
vqmf¶
struct vqmf
{
quatf rotation; // The rotation part.
vector4f translation_m22; // The translation part in [xyz] and the m22 value of the scale/shear matrix in [w].
vector4f x_axis_m20; // The X axis of the scale/shear matrix in [xyz] and the m20 value of that matrix in [w].
vector4f y_axis_m21; // The Y axis of the scale/shear matrix in [xyz] and the m21 value of that matrix in [w].
};
A VQM transform represents a 3D rotation (quaternion), a 3D translation (vector), and a 3D scale/shear (3x3 matrix). The scale/shear part can contain a non-uniform scale, shear, and a reflection. A point transforms as follows: p' = p * M * R + t, with M the scale/shear matrix and R the rotation matrix of the quaternion. VQM transforms form a group: the multiplication and the inverse are well defined. The multiplication is associative but not commutative, as with quaternions and matrices. The rotation must be a normalized quaternion. The internal format is opaque: use the vqm_* functions. The [w] lanes hold the third row of M: m20 = z_axis.x, m21 = z_axis.y, and m22 = z_axis.z. Thus the transform uses 4 registers.
vqmd¶
struct vqmd
{
quatd rotation; // The rotation part.
vector4d translation_m22; // The translation part in [xyz] and the m22 value of the scale/shear matrix in [w].
vector4d x_axis_m20; // The X axis of the scale/shear matrix in [xyz] and the m20 value of that matrix in [w].
vector4d y_axis_m21; // The Y axis of the scale/shear matrix in [xyz] and the m21 value of that matrix in [w].
};
A VQM transform represents a 3D rotation (quaternion), a 3D translation (vector), and a 3D scale/shear (3x3 matrix). The scale/shear part can contain a non-uniform scale, shear, and a reflection. A point transforms as follows: p' = p * M * R + t, with M the scale/shear matrix and R the rotation matrix of the quaternion. VQM transforms form a group: the multiplication and the inverse are well defined. The multiplication is associative but not commutative, as with quaternions and matrices. The rotation must be a normalized quaternion. The internal format is opaque: use the vqm_* functions. The [w] lanes hold the third row of M: m20 = z_axis.x, m21 = z_axis.y, and m22 = z_axis.z. Thus the transform uses 4 registers.
matrix3x3f¶
struct matrix3x3f
{
vector4f x_axis; // The X axis.
vector4f y_axis; // The Y axis.
vector4f z_axis; // The Z axis.
};
A generic 3x3 matrix. Note: The [w] component of every column vector is undefined.
matrix3x3d¶
struct matrix3x3d
{
vector4d x_axis; // The X axis.
vector4d y_axis; // The Y axis.
vector4d z_axis; // The Z axis.
};
A generic 3x3 matrix. Note: The [w] component of every column vector is undefined.
matrix3x4f¶
struct matrix3x4f
{
vector4f x_axis; // The X axis.
vector4f y_axis; // The Y axis.
vector4f z_axis; // The Z axis.
vector4f w_axis; // The W axis. It holds the translation.
};
An 3x4 affine matrix represents a 3D rotation, 3D translation, and 3D scale. It properly deals with skew/shear when present but once scale with mirroring is combined, it cannot be safely extracted back.
Affine matrices are 4x4 but have their last row always equal to [0, 0, 0, 1] which is why it is 3x4. Note: We do not track the implicit last row and it is thus undefined.
Left handed coordinate system: X axis == forward Y axis == right Z axis == up
matrix3x4d¶
struct matrix3x4d
{
vector4d x_axis; // The X axis.
vector4d y_axis; // The Y axis.
vector4d z_axis; // The Z axis.
vector4d w_axis; // The W axis. It holds the translation.
};
An 3x4 affine matrix represents a 3D rotation, 3D translation, and 3D scale. It properly deals with skew/shear when present but once scale with mirroring is combined, it cannot be safely extracted back.
Affine matrices are 4x4 but have their last row always equal to [0, 0, 0, 1] which is why it is 3x4. Note: We do not track the implicit last row and it is thus undefined.
Left handed coordinate system: X axis == forward Y axis == right Z axis == up
matrix4x4f¶
struct matrix4x4f
{
vector4f x_axis; // The X axis.
vector4f y_axis; // The Y axis.
vector4f z_axis; // The Z axis.
vector4f w_axis; // The W axis.
};
A generic 4x4 matrix.
matrix4x4d¶
struct matrix4x4d
{
vector4d x_axis; // The X axis.
vector4d y_axis; // The Y axis.
vector4d z_axis; // The Z axis.
vector4d w_axis; // The W axis.
};
A generic 4x4 matrix.
mix4¶
enum class mix4
{
x = 0,
y = 1,
z = 2,
w = 3,
a = 4,
b = 5,
c = 6,
d = 7,
};
Represents a component when mixing/shuffling/permuting vectors. [xyzw] are used to refer to the first input while [abcd] refer to the second input.
axis3¶
enum class axis3
{
x = 0,
y = 1,
z = 2,
};
Represents an axis in 3D.
axis4¶
enum class axis4
{
x = 0,
y = 1,
z = 2,
w = 3,
};
Represents an axis in 4D.
component2¶
enum class component2
{
x = 0,
y = 1,
};
Represents 2D vector components.
component3¶
enum class component3
{
x = 0,
y = 1,
z = 2,
};
Represents 3D vector components.
component4¶
enum class component4
{
x = 0,
y = 1,
z = 2,
w = 3,
};
Represents 4D vector components.
float2f¶
struct float2f
{
float x; // The [x] component.
float y; // The [y] component.
};
An unaligned 2D vector of float32 values, suitable for interop. with GPUs, etc.
float3f¶
struct float3f
{
float x; // The [x] component.
float y; // The [y] component.
float z; // The [z] component.
};
An unaligned 3D vector of float32 values, suitable for interop. with GPUs, etc.
float4f¶
struct float4f
{
float x; // The [x] component.
float y; // The [y] component.
float z; // The [z] component.
float w; // The [w] component.
};
An unaligned 4D vector of float32 values, suitable for interop. with GPUs, etc.
float2d¶
struct float2d
{
double x; // The [x] component.
double y; // The [y] component.
};
An unaligned 2D vector of float64 values, suitable for interop. with GPUs, etc.
float3d¶
struct float3d
{
double x; // The [x] component.
double y; // The [y] component.
double z; // The [z] component.
};
An unaligned 3D vector of float64 values, suitable for interop. with GPUs, etc.
float4d¶
struct float4d
{
double x; // The [x] component.
double y; // The [y] component.
double z; // The [z] component.
double w; // The [w] component.
};
An unaligned 4D vector of float64 values, suitable for interop. with GPUs, etc.