The Quaternary element is the simplest super-plural element. For example, a + bi + cj + dk.
Make the p = w1 + x1 * I + y1 * j + z1 * k = w1 + v1 (Real + virtual ).
Set the QQ = w2 + x2 * I + y2 * j + z2 * k = w2 + v2 (real part + virtual part ).
Addition: p + q = (w1 + w2) + (x1 + x2) * I + (y1 + y2) * j + (z1 + z2) * k
Multiplication: p * q = (w1 + (x1 * I + y1 * j + z1 * k )) * (w2 + (x2 * I + y2 * j + z2 * k ))
= W1 * w2-v1. v2 (DOT multiplication) + v1 X v2 (Cross multiplication) + w1 * v2 + w2 * v1
Purpose: Replace the rotation matrix.
For example, in 3D ry, if the θ degrees of a particle wound vector (a, B, c) are required to be rotated, the following can be represented by a four-element (x, y, z, w:
Make s = sin (θ/2), c = cos (θ/2)
X = s *,
Y = s * B,
Z = s * c,
W = c
Conversion Between the rotation matrix and the Quaternary element:
[W2 + x2-y2-z2, 2xy-2wz, 2xz + 2wy]
[2xy + 2wz, w2-x2-y2-z2, 2yz-2wx]
[2xz-2wy, 2yz + 2wx, w2-x2-y2-z2]