Ir para o conteúdo principal
Version: bleeding-edge 🩸

🔢 Quat

Floating point Quaternion that can represent a rotation about an axis in 3-D space


🎒 Examples​

local new_quaternion = Quat(0.5, 0.5, 1, -1)
local rotation = new_quaternion:Rotator()

🛠 Constructors​

Default Constructor​

No description provided

local my_quat = Quat(X?, Y?, Z?, W?)

Parameters

TypeNameDefaultDescription
floatX0The quaternion's X-component
floatYXThe quaternion's Y-component
floatZXThe quaternion's Z-component
floatWXThe quaternion's W-component

🧽 Properties​

TypeNameDescription
floatXThe quaternion's X-component
floatYThe quaternion's Y-component
floatZThe quaternion's Z-component
floatWThe quaternion's W-component

🦠 Functions​

info

This structure supports *, +, - and tostring operations.

ReturnsNameDescription
NormalizeIn place normalize this Quaternion
RotatorRotatorGet the Rotator representation of this Quaternion
QuatInverseReturns the inverse of this Quaternion
VectorRotateVectorRotates a vector by this Quaternion
VectorUnrotateVectorUnrotates a vector by this Quaternion
VectorGetForwardVectorGet the forward direction vector from this Quaternion
VectorGetRightVectorGet the right direction vector from this Quaternion
VectorGetUpVectorGet the up direction vector from this Quaternion

Optimal

Normalize​

In place normalize this Quaternion
my_quat:Normalize(tolerance?)

Parameters

TypeParameterDefaultDescription
floattolerance?0.000001
Minimum squared size to consider it non-zero

Optimal

Rotator​

Get the Rotator representation of this Quaternion
local ret = my_quat:Rotator()

Returns

TypeDescription
RotatorRotator representation of this Quaternion

Optimal

Inverse​

Returns the inverse of this Quaternion
local ret = my_quat:Inverse()

Returns

TypeDescription
QuatInverse of this Quaternion

Optimal

RotateVector​

Rotates a vector by this Quaternion
local ret = my_quat:RotateVector(vector)

Parameters

TypeParameterDefaultDescription
Vectorvector Required parameter Vector to rotate

Returns

TypeDescription
VectorRotated vector

Optimal

UnrotateVector​

Unrotates a vector by this Quaternion
local ret = my_quat:UnrotateVector(vector)

Parameters

TypeParameterDefaultDescription
Vectorvector Required parameter Vector to unrotate

Returns

TypeDescription
VectorUnrotated vector

Optimal

GetForwardVector​

Get the forward direction vector from this Quaternion
local ret = my_quat:GetForwardVector()

Returns

TypeDescription
VectorForward vector

Optimal

GetRightVector​

Get the right direction vector from this Quaternion
local ret = my_quat:GetRightVector()

Returns

TypeDescription
VectorRight vector

Optimal

GetUpVector​

Get the up direction vector from this Quaternion
local ret = my_quat:GetUpVector()

Returns

TypeDescription
VectorUp vector