Skip to content

rtm/vqd.h

#include "rtm/vqd.h"

vq_cast

vqd vq_cast(vqf input)

Casts a VQ transform float32 variant to a float64 variant.

vq_from_matrix

vqd vq_from_matrix(matrix3x3d input)

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

vqd vq_from_matrix(matrix3x4d input)

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

vq_mul

vqd vq_mul(vqd lhs, vqd rhs)

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

vq_mul_point3

vector4d vq_mul_point3(vector4d point, vqd 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

vqd vq_inverse(vqd input)

Returns the inverse of the input VQ transform.

vq_normalize

vqd vq_normalize(vqd input)

Returns a VQ transforms with the rotation part normalized.

vq_lerp

vqd vq_lerp(vqd start, vqd end, double 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

vqd vq_slerp(vqd start, vqd end, double alpha)

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

vq_is_finite

bool vq_is_finite(vqd input)

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

vq_set

constexpr vqd vq_set(quatd rotation, vector4d translation)

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

vq_identity

vqd vq_identity()

Returns the identity VQ transform.

The return value also converts to vqf.