Skip to content

rtm/vqsd.h

#include "rtm/vqsd.h"

vqs_cast

vqsd vqs_cast(vqsf input)

Casts a VQS transform float32 variant to a float64 variant.

vqs_from_matrix

vqsd vqs_from_matrix(matrix3x3d input)

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

vqsd vqs_from_matrix(matrix3x4d 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

quatd vqs_get_rotation(vqsd input)

Returns the rotation part of a VQS transform.

vqs_get_translation

vector4d vqs_get_translation(vqsd input)

Returns the translation part of a VQS transform.

vqs_get_scale

double vqs_get_scale(vqsd input)

Returns the scale part of a VQS transform.

vqs_mul

vqsd vqs_mul(vqsd lhs, vqsd 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

vqsd vqs_mul_no_scale(vqsd lhs, vqsd 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

vector4d vqs_mul_point3(vector4d point, vqsd 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

vector4d vqs_mul_point3_no_scale(vector4d point, vqsd 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

vqsd vqs_inverse(vqsd 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.

vqsd vqs_inverse(vqsd input, double fallback_scale, double threshold=1.0E-8)

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

vqsd vqs_inverse_no_scale(vqsd input)

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

vqs_normalize

vqsd vqs_normalize(vqsd input)

Returns a VQS transforms with the rotation part normalized.

vqs_lerp

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

vqs_lerp_no_scale

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

vqs_slerp

vqsd vqs_slerp(vqsd start, vqsd end, double alpha)

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

vqs_slerp_no_scale

vqsd vqs_slerp_no_scale(vqsd start, vqsd end, double alpha)

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

vqs_is_finite

bool vqs_is_finite(vqsd input)

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

vqs_set

vqsd vqs_set(quatd rotation, vector4d translation, double scale)

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

vqs_identity

vqsd vqs_identity()

Returns the identity VQS transform.

The return value also converts to vqsf.