Contains the definition and functions for rotations expressed as 4-dimensional vectors @author Richard Greenlees @author Kai Burjack with modifications and additions for Field
| 39 | * @author Kai Burjack |
| 40 | * with modifications and additions for Field |
| 41 | */ |
| 42 | @SafeToToString |
| 43 | public class Quat implements Externalizable, Supplier<Quat> { |
| 44 | |
| 45 | private static final long serialVersionUID = 1L; |
| 46 | |
| 47 | /** |
| 48 | * The first component of the vector part. |
| 49 | */ |
| 50 | public double x; |
| 51 | /** |
| 52 | * The second component of the vector part. |
| 53 | */ |
| 54 | public double y; |
| 55 | /** |
| 56 | * The third component of the vector part. |
| 57 | */ |
| 58 | public double z; |
| 59 | /** |
| 60 | * The real/scalar part of the quaternion. |
| 61 | */ |
| 62 | public double w; |
| 63 | |
| 64 | /** |
| 65 | * Create a new {@link Quat} and initialize it with <tt>(x=0, y=0, z=0, w=1)</tt>, where <tt>(x, y, z)</tt> is the vector part of the quaternion and <tt>w</tt> is the real/scalar part. |
| 66 | */ |
| 67 | public Quat() { |
| 68 | x = 0.0; |
| 69 | y = 0.0; |
| 70 | z = 0.0; |
| 71 | w = 1.0; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Create a new {@link Quat} and initialize its components to the given values. |
| 76 | * |
| 77 | * @param x the first component of the imaginary part |
| 78 | * @param y the second component of the imaginary part |
| 79 | * @param z the third component of the imaginary part |
| 80 | * @param w the real part |
| 81 | */ |
| 82 | public Quat(double x, double y, double z, double w) { |
| 83 | this.x = x; |
| 84 | this.y = y; |
| 85 | this.z = z; |
| 86 | this.w = w; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Create a new {@link Quat} and initialize its imaginary components to the given values, and its real part to <tt>1.0</tt>. |
| 91 | * |
| 92 | * @param x the first component of the imaginary part |
| 93 | * @param y the second component of the imaginary part |
| 94 | * @param z the third component of the imaginary part |
| 95 | */ |
| 96 | public Quat(double x, double y, double z) { |
| 97 | this.x = x; |
| 98 | this.y = y; |
no outgoing calls
no test coverage detected