Skip to content

rtm/vqsf.h

#include "rtm/vqsf.h"

vqs_cast

vqsf vqs_cast(vqsd input)

Casts a VQS transform float64 variant to a float32 variant.

vqs_from_matrix

vqsf vqs_from_matrix(matrix3x3f input)

Converts a rotation 3x3 matrix into a VQS transform. The translation/scale will be the identity.

vqsf vqs_from_matrix(matrix3x4f input)

Converts a rotation 3x4 affine matrix into a VQS transform. If the matrix scale is non-uniform, the scale of the largest axis will be returned.

vqs_get_rotation

quatf vqs_get_rotation(vqsf input)

Returns the rotation part of a VQS transform.

vqs_get_translation

vector4f vqs_get_translation(vqsf input)

Returns the translation part of a VQS transform.

vqs_get_scale

float vqs_get_scale(vqsf input)

Returns the scale part of a VQS transform.

vqs_mul

vqsf vqs_mul(vqsf lhs, vqsf rhs)

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

vqs_mul_no_scale

vqsf vqs_mul_no_scale(vqsf lhs, vqsf rhs)

Multiplies two VQS transforms ignoring scale. The resulting VQS transform will have the LHS scale. Multiplication order is as follow: local_to_world = vqs_mul(local_to_object, object_to_world)

vqs_mul_point3

vector4f vqs_mul_point3(vector4f point, vqsf vqs)

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

vqs_mul_point3_no_scale

vector4f vqs_mul_point3_no_scale(vector4f point, vqsf vqs)

Multiplies a VQS transform and a 3D point ignoring 3D scale. Multiplication order is as follow: world_position = vqs_mul_point3_no_scale(local_position, local_to_world)

vqs_inverse

vqsf vqs_inverse(vqsf input)

Returns the inverse of the input VQS transform. If zero scale is contained, the result is undefined. For a safe alternative, supply a fallback scale value and a threshold.

vqsf vqs_inverse(vqsf input, float fallback_scale, float threshold=1.0E-8F)

Returns the inverse of the input VQS transform. If the input scale has an absolute value below the supplied threshold, the fallback value is used instead.

vqs_inverse_no_scale

vqsf vqs_inverse_no_scale(vqsf input)

Returns the inverse of the input VQS transform ignoring 3D scale. The resulting VQS transform will have the input scale.

vqs_normalize

vqsf vqs_normalize(vqsf input)

Returns a VQS transforms with the rotation part normalized.

vqs_lerp

vqsf vqs_lerp(vqsf start, vqsf 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)).

vqs_lerp_no_scale

vqsf vqs_lerp_no_scale(vqsf start, vqsf 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)). The resulting VQV transform will have the start scale.

vqs_slerp

vqsf vqs_slerp(vqsf start, vqsf end, float alpha)

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

vqs_slerp_no_scale

vqsf vqs_slerp_no_scale(vqsf start, vqsf end, float alpha)

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

vqs_is_finite

bool vqs_is_finite(vqsf input)

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

vqs_set

vqsf vqs_set(quatf rotation, vector4f translation, float scale)

Creates a VQS transform from a rotation quaternion, a translation, and scalar scale.

vqs_identity

vqsf vqs_identity()

Returns the identity VQS transform.

The return value also converts to vqsd.