Quaternion
ReferencesThe first value a is the real part, while the rest multiplies i, j and k, that are imaginary.
quaternion = a + bi + cj + dk
Constructors
Properties
This is (a,-b,-c,-d)
(a/L2, -b/L2, -c/L2, -d/L2),
where L2 = length squared = (a*a + b*b + c*c + d*d).
This is the multiplicative inverse, i.e., (a,b,c,d)*(a/L2, -b/L2, -c/L2, -d/L2) = (1,0,0,0). If this is the zero quaternion, then the zero quaternion is returned.Methods
where (x,y,z) = CrossProduct(p.Vector,q.Vector).
This is not the same as the quaternion product p*q.
Equals
#GetHashCode
#(a/L2, -b/L2, -c/L2, -d/L2),
where L2 = length squared = (a*a + b*b + c*c + d*d).
This is the multiplicative inverse, i.e., (a,b,c,d)*(a/L2, -b/L2, -c/L2, -d/L2) = (1,0,0,0).
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| Quaternion | + | Quaternion | Quaternion | Adds two quaternions. This sums each quaternion coefficient with its correspondent and returns a new result quaternion. |
| Quaternion | / | double | Quaternion | Divides all quaternion coefficients by a factor and returns a new quaternion with the result. |
| Quaternion | == | Quaternion | bool | Determines whether two quaternions have the same value. |
| Quaternion | != | Quaternion | bool | Determines whether two quaternions have different values. |
| Quaternion | * | Quaternion | Quaternion | Multiplies a quaternion with another one. Quaternion multiplication (Hamilton product) is not commutative. |
| Quaternion | * | double | Quaternion | Multiplies (scales) all quaternion coefficients by a factor and returns a new quaternion with the result. |
| Quaternion | * | float | Quaternion | Multiplies (scales) all quaternion coefficients by a factor and returns a new quaternion with the result. |
| Quaternion | * | int | Quaternion | Multiplies (scales) all quaternion coefficients by a factor and returns a new quaternion with the result. |
| Quaternion | - | Quaternion | Quaternion | Subtracts a quaternion from another one. This computes the difference of each quaternion coefficient with its correspondent and returns a new result quaternion. |