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

👐Open Source
This structure is Open Sourced on GitHub. Feel free to make pull requests and suggest changes!

🎒 Examples

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

🛠 Constructors

Default Constructor

local my_quat = Quat(X?, Y?, Z?, W?)
TypeNameDefaultDescription
number X0The quaternion's X-component
number Y0The quaternion's Y-component
number Z0The quaternion's Z-component
number W0The quaternion's W-component

🧽 Properties

TypeNameDescription
number XThe quaternion's X-component
number YThe quaternion's Y-component
number ZThe quaternion's Z-component
number WThe quaternion's W-component

🦠 Functions

info

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

ReturnsNameDescription
NormalizeIn place normalize this Quaternion
Rotator RotatorGet the Rotator representation of this Quaternion
Quat InverseReturns the inverse of this Quaternion

Normalize

In place normalize this Quaternion
my_quat:Normalize()

Rotator

Get the Rotator representation of this Quaternion

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

Inverse

Returns the inverse of this Quaternion

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