Quaternion
              Quaternion(s, x, y, z)
¶
    A class supporting quaternion arithmetic
Initializes the pymolecule.Quaternion class.
| PARAMETER | DESCRIPTION | 
|---|---|
                s
             | 
            
               ???? 
  | 
          
                x
             | 
            
               ???? 
  | 
          
                y
             | 
            
               ???? 
  | 
          
                z
             | 
            
               ???? 
  | 
          
            v = np.zeros(4)
  
      instance-attribute
  
¶
    
            __str__()
¶
    String containing quaternion information in the form of s x y z
| RETURNS | DESCRIPTION | 
|---|---|
| 
               A string, containing all information about this quaternion  | 
          
            add(q2)
¶
    Adds two quaternions.
| PARAMETER | DESCRIPTION | 
|---|---|
                q2
             | 
            
               A quaternion, to be added to self. 
  | 
          
| RETURNS | DESCRIPTION | 
|---|---|
| 
               A Quaternion, with the values corresponding to self + q2.  | 
          
            copy_of()
¶
    Returns a copy of self
            invert()
¶
    Takes the inverse of the quaternion for "division"
Returns: A Quaternion, with the values corresponding to self^-1
            load_from_mat(m)
¶
    Converts a rotation matrix that is pure orthogonal (det(matrix)=1) into a Quaternion. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
| PARAMETER | DESCRIPTION | 
|---|---|
                m
             | 
            
               A 2D np.array representing a pure orthogonal matrix. 
  | 
          
            minus(q2)
¶
    Multiplies two quaternions
| PARAMETER | DESCRIPTION | 
|---|---|
                q2
             | 
            
               A quaternion, to be subtracted from self 
  | 
          
| RETURNS | DESCRIPTION | 
|---|---|
| 
               A Quaternion, with the values corresponding to self - q2  | 
          
            multiply(q2)
¶
    Multiplies two quaternions
| PARAMETER | DESCRIPTION | 
|---|---|
                q2
             | 
            
               A quaternion, to be multiplied with self 
  | 
          
| RETURNS | DESCRIPTION | 
|---|---|
| 
               A Quaternion, with the values corresponding to self * q2  | 
          
            normalize()
¶
    Normalizes the quaternion.
| RETURNS | DESCRIPTION | 
|---|---|
| 
               A normalized Quaternion.  | 
          
            rep_as_44_matrix()
¶
    Creates a 4x4 matrix representation of the Quaternion.
| RETURNS | DESCRIPTION | 
|---|---|
| 
               A 4x4 numpy array  | 
          
            scale(scalar)
¶
    Scales a quaternion.
| PARAMETER | DESCRIPTION | 
|---|---|
                scalar
             | 
            
               the value to scale the quaternion by. 
  | 
          
| RETURNS | DESCRIPTION | 
|---|---|
| 
               A Quaternion, with the values corresponding to self * scalar.  | 
          
            to_matrix()
¶
    Converts to a normalized 3x3 matrix.
| RETURNS | DESCRIPTION | 
|---|---|
| 
               A 3x3 np.array, corresponding to the quaternion.  |