# Difference between revisions of "Quaternion Class"

Line 1: | Line 1: | ||

− | {{TDClassSummary|summary=Quaternion}} | + | {{TDClassSummary|label=Quaternion|summary=Quaternion}} |

<section begin=HELPBODY /> | <section begin=HELPBODY /> | ||

{{ClassMemberSection|empty= | {{ClassMemberSection|empty= |

## Revision as of 14:20, 25 May 2018

Quaternion

## Members

`w`

→ `float`

**(Read Only)**:

Quaternion_w

`x`

→ `float`

**(Read Only)**:

Quaternion_x

`y`

→ `float`

**(Read Only)**:

Quaternion_y

`z`

→ `float`

**(Read Only)**:

Quaternion_z

## Methods

`lerp(q2, lerpF)`

→ `quaternion`

:

Returns a quaternion as the linear interpolation of the current quaternion (q) and another quaternion (q2) using an interpolation factor (lerpF) in the range [0,1].

l = q.lerp(q2, lerpF)

`length()`

→ `float`

:

Returns the length of the current quaternion.

l = q.length()

`cross(q2)`

→ `vector`

:

Returns the cross product of the current quaternion and another quaternion.

l = q.cross(q2)

`rotate(vec)`

→ `vector`

:

Rotates a vector using the current quaternion and returns a new vector.

l= q.rotate(vec)

`slerp(q2, slerpF)`

→ `quaternion`

:

Returns a quaternion as the spherical interpolation of the current quaternion (q) and another quaternion (q2) using an interpolation factor (slerpF).

l = q.slerp(q2, slerpF)

`eulerAngles(order='xyz')`

→ `tuple`

:

Returns euler angles in degrees as a tuple (i.e. pitch as x, yaw as y, roll as z) from current quaternion. The 'order' argument can be set to any valid rotation order which by default is set to 'xyz'.

l = q.eulerAngles(order='xyz')

`axis()`

→ `vector`

:

Returns the rotation axis vector of the current.

l = q.axis()

`dot(q2)`

→ `float`

:

Returns the dot product (float) of the current quaternion and another quaternion.

l = q.dot(q2)

`exp()`

→ `quaternion`

:

Returns the exponential of the current as a new quaternion.

l = q.exp()

`copy()`

→ `quaternion`

:

Quaternion copy

`log()`

→ `quaternion`

:

Returns the natural logarithm of the current as a new quaternion.

l = q.log()

`inverse()`

→ `None`

:

Invert the current quaternion.

q.inverse()

`angle()`

→ `float`

:

Returns the rotation angle (in degrees) of the current.

l = q.angle()

TouchDesigner Build: