/** * Divides the components of this quaternion by a float scalar. * * @param a The division scalar * @return A new quaternion, which has each component divided by the scalar */ public Quaterniond div(float a) { return div((double) a); }
/** * Divides this quaternions by the float components of another one. * * @param x The x (imaginary) component of the quaternion to divide with * @param y The y (imaginary) component of the quaternion to divide with * @param z The z (imaginary) component of the quaternion to divide with * @param w The w (real) component of the quaternion to divide with * @return The quotient of the two quaternions */ public Quaterniond div(float x, float y, float z, float w) { return div((double) x, (double) y, (double) z, (double) w); }
/** * Divides this quaternions by another one. * * @param q The quaternion to divide with * @return The quotient of the two quaternions */ public Quaterniond div(Quaterniond q) { return div(q.x, q.y, q.z, q.w); }
/** * Divides the components of this quaternion by a float scalar. * * @param a The division scalar * @return A new quaternion, which has each component divided by the scalar */ public Quaterniond div(float a) { return div((double) a); }
/** * Divides this quaternions by another one. * * @param q The quaternion to divide with * @return The quotient of the two quaternions */ public Quaterniond div(Quaterniond q) { return div(q.x, q.y, q.z, q.w); }
/** * Divides this quaternions by the float components of another one. * * @param x The x (imaginary) component of the quaternion to divide with * @param y The y (imaginary) component of the quaternion to divide with * @param z The z (imaginary) component of the quaternion to divide with * @param w The w (real) component of the quaternion to divide with * @return The quotient of the two quaternions */ public Quaterniond div(float x, float y, float z, float w) { return div((double) x, (double) y, (double) z, (double) w); }
/** * Inverts the quaternion. <br> Inversion of a quaternion <code>a</code> returns quaternion <code>a<sup>-1</sup> = a' / |a|<sup>2</sup></code> where <code>a'</code> is {@link #conjugate() * conjugation} of <code>a</code>, and <code>|a|<sup>2</sup></code> is squared length of <code>a</code>. <br> For any quaternions <code>a, b, c</code>, such that <code>a * b = c</code> equations * <code>a<sup>-1</sup> * c = b</code> and <code>c * b<sup>-1</sup> = a</code> are true. * * @return the inverted quaternion */ @Override public Quaterniond invert() { final double lengthSquared = lengthSquared(); if (Math.abs(lengthSquared) < GenericMath.DBL_EPSILON) { throw new ArithmeticException("Cannot invert a quaternion of length zero"); } return conjugate().div(lengthSquared); }
/** * Inverts the quaternion. <br> Inversion of a quaternion <code>a</code> returns quaternion <code>a<sup>-1</sup> = a' / |a|<sup>2</sup></code> where <code>a'</code> is {@link #conjugate() * conjugation} of <code>a</code>, and <code>|a|<sup>2</sup></code> is squared length of <code>a</code>. <br> For any quaternions <code>a, b, c</code>, such that <code>a * b = c</code> equations * <code>a<sup>-1</sup> * c = b</code> and <code>c * b<sup>-1</sup> = a</code> are true. * * @return the inverted quaternion */ @Override public Quaterniond invert() { final double lengthSquared = lengthSquared(); if (Math.abs(lengthSquared) < GenericMath.DBL_EPSILON) { throw new ArithmeticException("Cannot invert a quaternion of length zero"); } return conjugate().div(lengthSquared); }