Quaternion:
Filter:
MathLib/Classes (extension) | Math | Libraries > MathLib > Cartesian &c.

Quaternion
ExtensionExtension

quaternion number

Description

A class representing quaternion numbers.

Part of MathLib, a diverse library of mathematical functions.

Class Methods

.new

Create a new quaternion with the given scalar and vector parts.

Arguments:

a

scalar part

b

vector part b

c

vector part c

d

vector part d

Returns:

a new instance of Quaternion.

.rand

Create a new quaternion with scalar and vector parts randomly choosen between min and max.

Arguments:

min

minimum value

max

maximum value

Returns:

a new instance of Quaternion.

Instance Methods

.a

Return the scalar part.

.b

Return the vector part b.

.c

Return the vector part c.

.d

Return the vector part d.

.coordinates

Return the scalar and vector parts.

.conjugate

Return the conjugate of q is the quaternion

.norm

Return the square root of the product of a quaternion with its conjugate.

.distance

Return the distance between two quaternions.

Examples