Skip to content

rtm/vqf.h

#include "rtm/vqf.h"

vq_cast

vqf vq_cast(vqd input)

Casts a VQ transform float64 variant to a float32 variant.

vq_from_matrix

vqf vq_from_matrix(matrix3x3f input)

Converts a rotation 3x3 matrix into a VQ transform. The translation will be the identity.

vqf vq_from_matrix(matrix3x4f input)

Converts a rotation 3x4 affine matrix into a VQ transform. If the matrix contains scale, it is stripped and lost.

vq_mul

vqf vq_mul(vqf lhs, vqf rhs)

Multiplies two VQ transforms. Multiplication order is as follow: local_to_world = vq_mul(local_to_object, object_to_world)

vq_mul_point3

vector4f vq_mul_point3(vector4f point, vqf vq)

Multiplies a VQ transform and a 3D point. Multiplication order is as follow: world_position = vq_mul_point3(local_position, local_to_world)

vq_inverse

vqf vq_inverse(vqf input)

Returns the inverse of the input VQ transform.

vq_normalize

vqf vq_normalize(vqf input)

Returns a VQ transforms with the rotation part normalized.

vq_lerp

vqf vq_lerp(vqf start, vqf end, float alpha)

Per component linear interpolation of the two inputs at the specified alpha. The formula used is: ((1.0 - alpha) * start) + (alpha * end). Interpolation is stable and will return 'start' when alpha is 0.0 and 'end' when it is 1.0. This is the same instruction count when FMA is present but it might be slightly slower due to the extra multiplication compared to: start + (alpha * (end - start)).

vq_slerp

vqf vq_slerp(vqf start, vqf end, float alpha)

Per component spherical interpolation of the two inputs at the specified alpha. See quat_slerp(..)

vq_is_finite

bool vq_is_finite(vqf input)

Returns true if the input VQ does not contain any NaN or Inf, otherwise false.

vq_set

constexpr vqf vq_set(quatf rotation, vector4f translation)

Creates a VQ transform from a rotation quaternion and a translation.

vq_identity

vqf vq_identity()

Returns the identity VQ transform.

The return value also converts to vqd.