Class QuaternionPredictor

java.lang.Object
com.irurueta.ar.slam.QuaternionPredictor

public class QuaternionPredictor extends Object
Utility class to predict rotations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Number of components on angular speed.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double[] w)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double[] w, boolean exactMethod)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double[] w, boolean exactMethod, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
    static void
    predict(com.irurueta.geometry.Quaternion q, double[] w, boolean exactMethod, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
    static void
    predict(com.irurueta.geometry.Quaternion q, double[] w, boolean exactMethod, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double[] w, double dt)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, boolean exactMethod)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, boolean exactMethod, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
    static void
    predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, boolean exactMethod, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
    static void
    predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, boolean exactMethod, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
    static void
    predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
    static void
    predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double[] w, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
    static void
    predict(com.irurueta.geometry.Quaternion q, double[] w, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
    static void
    predict(com.irurueta.geometry.Quaternion q, double[] w, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, boolean exactMethod)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, boolean exactMethod, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
    static void
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, boolean exactMethod, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
    static void
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, boolean exactMethod, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, boolean exactMethod)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, boolean exactMethod, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
    static void
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, boolean exactMethod, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
    static void
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, boolean exactMethod, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x,y,z (roll, pitch, yaw).
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
    static void
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
    static void
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
    static com.irurueta.geometry.Quaternion
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
    static void
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
    static void
    predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
    static com.irurueta.geometry.Quaternion
    predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double[] w, double dt)
    Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
    static com.irurueta.geometry.Quaternion
    predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double[] w, double dt, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianDQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
    static void
    predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double[] w, double dt, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
    static void
    predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double[] w, double dt, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianDQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x, y, z (roll, pitch, yaw).
    static com.irurueta.geometry.Quaternion
    predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double wx, double wy, double wz, double dt)
    Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
    static com.irurueta.geometry.Quaternion
    predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double wx, double wy, double wz, double dt, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianDQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
    static void
    predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double wx, double wy, double wz, double dt, com.irurueta.geometry.Quaternion result)
    Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x, y, z (roll, pitch, yaw).
    static void
    predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double wx, double wy, double wz, double dt, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianDQ, com.irurueta.algebra.Matrix jacobianW)
    Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ANGULAR_SPEED_COMPONENTS

      public static final int ANGULAR_SPEED_COMPONENTS
      Number of components on angular speed.
      See Also:
  • Constructor Details

    • QuaternionPredictor

      private QuaternionPredictor()
      Constructor.
  • Method Details

    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, boolean exactMethod, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x,y,z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      exactMethod - true to use exact method, false to use "Tustin" method.
      result - instance where updated quaternion is stored.
      jacobianQ - jacobian wrt input quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, boolean exactMethod, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      dt - time interval to compute prediction expressed in seconds.
      exactMethod - true to use exact method, false to use "Tustin" method.
      result - instance where update quaternion is stored.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size, or w does not have length 3.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      result - instance where update quaternion is stored.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      dt - time interval to compute prediction expressed in seconds.
      result - instance where update quaternion is stored.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, boolean exactMethod, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      exactMethod - true to use exact method, false to use "Tustin" method.
      result - instance where update quaternion is stored.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, boolean exactMethod, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      dt - time interval to compute prediction expressed in seconds.
      exactMethod - true to use exact method, false to use "Tustin" method.
      result - instance where update quaternion is stored.
      Throws:
      IllegalArgumentException - if w does not have length 3.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      result - instance where update quaternion is stored.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      dt - time interval to compute prediction expressed in seconds.
      result - instance where update quaternion is stored.
      Throws:
      IllegalArgumentException - if w does not have length 3
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, boolean exactMethod, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      exactMethod - true to use exact method, false to use "Tustin" method.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, boolean exactMethod, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      dt - time interval to compute prediction expressed in seconds.
      exactMethod - true to use exact method, false to use "Tustin" method.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size or w does not have length 3.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      dt - time interval to compute prediction expressed in seconds.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt, boolean exactMethod)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      exactMethod - true to use exact method, false to use "Tustin" method.
      Returns:
      a new quaternion containing updated quaternion.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double[] w, double dt, boolean exactMethod)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      dt - time interval to compute prediction expressed in seconds.
      exactMethod - true to use exact method, false to use "Tustin" method.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if w does not have length 3
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, double dt)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      Returns:
      a new quaternion containing updated quaternion.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double[] w, double dt)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) using exact method.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      dt - time interval to compute prediction expressed in seconds.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if w does not have length 3.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, boolean exactMethod, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      exactMethod - true to use exact method, false to use "Tustin" method.
      result - instance where update quaternion is stored.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double[] w, boolean exactMethod, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      exactMethod - true to use exact method, false to use "Tustin" method.
      result - instance where update quaternion is stored.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      result - instance where update quaternion is stored.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double[] w, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      result - instance where update quaternion is stored.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, boolean exactMethod, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      exactMethod - true to use exact method, false to use "Tustin" method.
      result - instance where update quaternion is stored.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double[] w, boolean exactMethod, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      exactMethod - true to use exact method, false to use "Tustin" method.
      result - instance where update quaternion is stored.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      result - instance where update quaternion is stored.
      See Also:
    • predict

      public static void predict(com.irurueta.geometry.Quaternion q, double[] w, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      result - instance where update quaternion is stored.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, boolean exactMethod, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      exactMethod - true to use exact method, false to use "Tustin" method.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double[] w, boolean exactMethod, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      exactMethod - true to use exact method, false to use "Tustin" method.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double[] w, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      jacobianQ - jacobian wrt quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz, boolean exactMethod)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      exactMethod - true to use exact method, false to use "Tustin" method.
      Returns:
      a new quaternion containing updated quaternion.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double[] w, boolean exactMethod)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      exactMethod - true to use exact method, false to use "Tustin" method.
      Returns:
      a new quaternion containing updated quaternion.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double wx, double wy, double wz)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
      Parameters:
      q - quaternion to be updated.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      Returns:
      a new quaternion containing updated quaternion.
      See Also:
    • predict

      public static com.irurueta.geometry.Quaternion predict(com.irurueta.geometry.Quaternion q, double[] w)
      Predicts the updated quaternion after a rotation in body frame expressed by the rate of rotation along axes x, y, z (roll, pitch, yaw) assuming a time interval of 1 second and exact method.
      Parameters:
      q - quaternion to be updated.
      w - array containing angular speed in the 3 axis (x = roll, y = pitch, z = yaw). Expressed in rad/se. Must have length 3
      Returns:
      a new quaternion containing updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
      See Also:
    • predictWithRotationAdjustment

      public static void predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double wx, double wy, double wz, double dt, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianDQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      dq - adjustment of rotation to be combined with input quaternion.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      result - instance where updated quaternion is stored.
      jacobianQ - jacobian wrt input quaternion. Must be 4x4.
      jacobianDQ - jacobian wrt dq quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
    • predictWithRotationAdjustment

      public static void predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double[] w, double dt, com.irurueta.geometry.Quaternion result, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianDQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      dq - adjustment of rotation to be combined with input quaternion.
      w - angular speed (x, y, z axes). Expressed in rad/s. Must have length 3.
      dt - time interval to compute prediction expressed in seconds.
      result - instance where updated quaternion is stored.
      jacobianQ - jacobian wrt input quaternion. Must be 4x4.
      jacobianDQ - jacobian wrt dq quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size or if w does not have length 3.
    • predictWithRotationAdjustment

      public static void predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double wx, double wy, double wz, double dt, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x, y, z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      dq - adjustment of rotation to be combined with input quaternion.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      result - instance where updated quaternion is stored.
    • predictWithRotationAdjustment

      public static void predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double[] w, double dt, com.irurueta.geometry.Quaternion result)
      Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      dq - adjustment of rotation to be combined with input quaternion.
      w - angular speed (x, y, z axes). Expressed in rad/s. Must have length 3.
      dt - time interval to compute prediction expressed in seconds.
      result - instance where updated quaternion is stored.
      Throws:
      IllegalArgumentException - if w does not have length 3.
    • predictWithRotationAdjustment

      public static com.irurueta.geometry.Quaternion predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double wx, double wy, double wz, double dt, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianDQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      dq - adjustment of rotation to be combined with input quaternion.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      jacobianQ - jacobian wrt input quaternion. Must be 4x4.
      jacobianDQ - jacobian wrt dq quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
    • predictWithRotationAdjustment

      public static com.irurueta.geometry.Quaternion predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double[] w, double dt, com.irurueta.algebra.Matrix jacobianQ, com.irurueta.algebra.Matrix jacobianDQ, com.irurueta.algebra.Matrix jacobianW)
      Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      dq - adjustment of rotation to be combined with input quaternion.
      w - angular speed (x,y,z axes). Expressed in rad/s. Must have length 3.
      dt - time interval to compute prediction expressed in seconds.
      jacobianQ - jacobian wrt input quaternion. Must be 4x4.
      jacobianDQ - jacobian wrt dq quaternion. Must be 4x4.
      jacobianW - jacobian wrt angular speed. Must be 4x3.
      Returns:
      a new updated quaternion.
      Throws:
      IllegalArgumentException - if any of provided jacobians does not have proper size.
    • predictWithRotationAdjustment

      public static com.irurueta.geometry.Quaternion predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double wx, double wy, double wz, double dt)
      Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      dq - adjustment of rotation to be combined with input quaternion.
      wx - angular speed in x-axis (roll axis). Expressed in rad/s.
      wy - angular speed in y-axis (pitch axis). Expressed in rad/s.
      wz - angular speed in z-axis (yaw axis). Expressed in rad/s.
      dt - time interval to compute prediction expressed in seconds.
      Returns:
      a new updated quaternion.
    • predictWithRotationAdjustment

      public static com.irurueta.geometry.Quaternion predictWithRotationAdjustment(com.irurueta.geometry.Quaternion q, com.irurueta.geometry.Quaternion dq, double[] w, double dt)
      Predicts the updated quaternion after a rotation in body frame expressed by provided rotation dq and by provided rate of rotation along axes x,y,z (roll, pitch, yaw).
      Parameters:
      q - quaternion to be updated.
      dq - adjustment of rotation to be combined with input quaternion.
      w - angular speed (x, y, z axes). Expressed in rad/s. Must have length 3.
      dt - time interval to compute prediction expressed in seconds.
      Returns:
      a new updated quaternion.
      Throws:
      IllegalArgumentException - if w does not have length 3.