| Top |
| double | quaternion_modulus () |
| struct quaternion | normalise_quaternion () |
| struct quaternion | random_quaternion () |
| int | quaternion_valid () |
| struct rvec | quat_rot () |
There is a simple quaternion structure in CrystFEL. At the moment, it is
only used when simulating patterns, as an argument to cell_rotate() to
orient the unit cell.
double
quaternion_modulus (struct quaternion q);
If a quaternion represents a pure rotation, its modulus should be unity.
struct quaternion
normalise_quaternion (struct quaternion q);
Rescales the quaternion such that its modulus is unity.
int
quaternion_valid (struct quaternion q);
Checks if the given quaternion is normalised.
This function performs a nasty floating point comparison of the form
(modulus > 0.999) && (modulus < 1.001), and so should not be
relied upon to spot anything other than the most obvious input error.
struct rvec quat_rot (struct rvec q,struct quaternion z);
Rotates a vector according to a quaternion.