nanome.util.quaternion module

class Quaternion(x=0, y=0, z=0, w=1)[source]

Bases: object

A vector that holds 4 values. Used for rotation.
EPS = 1e-06
dot(other)[source]
Returns the dot between this and another Quaternion
Parameters:other (Quaternion) – Quaternion to dot product with
Returns:A float value representing the dot product.
Return type:float
equals(other)[source]
classmethod from_matrix(matrix)[source]

Creates a Quaternion from a 4x4 affine transformation matrix.

Parameters:matrix (list <list <float>>) – A 4x4 affine transformation matrix
Returns:A Quaternion representing a rotation.
Return type:Quaternion
get_conjugate()[source]
Returns the conjugate of this Quaternion.
Returns:A new Quaternion that is the conjugate of this Quaternion.
Return type:Quaternion
get_copy()[source]
Returns:A copy of this Quaternion.
Return type:Quaternion
rotate_vector(point)[source]
Rotates a vector using this Quaternion.
Parameters:point (Vector3) – The vector to rotate
Returns:A rotated vector.
Return type:vector3
set(x, y, z, w)[source]
w
Returns:This quaternion’s w component.
Return type:float
x
Returns:This quaternion’s x component.
Return type:float
y
Returns:This quaternion’s y component.
Return type:float
z
Returns:This quaternion’s z component.
Return type:float