Skip to content

rtm/packing/quatf.h

#include "rtm/packing/quatf.h"

quat_ensure_positive_w

quatf quat_ensure_positive_w(quatf input)

Returns the quaternion on the hypersphere with a positive [w] component that represents the same 3D rotation as the input.

quat_from_positive_w

quatf quat_from_positive_w(vector4f input)

Returns a quaternion constructed from a vector3 representing the [xyz] components while reconstructing the [w] component by assuming it is positive. Note: When the squared length of [xyz] is very small, the square-root might not be very accurate when [w] is reconstructed. As such, the resulting quaternion might be near but not quite normalized. If high accuracy is required, make sure to normalize explicitly afterwards.