/** * Creates a new quaternion from the rotation float angle in radians around the axis vector. * * @param angle The rotation angle in radians * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleRadAxis(float angle, Vector3d axis) { return fromAngleRadAxis((double) angle, axis); }
/** * Creates a new quaternion from the rotation float angle in radians around the axis vector float components. * * @param angle The rotation angle in radians * @param x The x component of the axis vector * @param y The y component of the axis vector * @param z The z component of the axis vector * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleRadAxis(float angle, float x, float y, float z) { return fromAngleRadAxis((double) angle, (double) x, (double) y, (double) z); }
/** * Creates a new quaternion from the rotation float angle in radians around the axis vector float components. * * @param angle The rotation angle in radians * @param x The x component of the axis vector * @param y The y component of the axis vector * @param z The z component of the axis vector * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleRadAxis(float angle, float x, float y, float z) { return fromAngleRadAxis((double) angle, (double) x, (double) y, (double) z); }
/** * Creates a new quaternion from the rotation float angle in radians around the axis vector. * * @param angle The rotation angle in radians * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleRadAxis(float angle, Vector3d axis) { return fromAngleRadAxis((double) angle, axis); }
/** * Creates a new quaternion from the rotation float angle in degrees around the axis vector float components. * * @param angle The rotation angle in degrees * @param x The x component of the axis vector * @param y The y component of the axis vector * @param z The z component of the axis vector * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleDegAxis(float angle, float x, float y, float z) { return fromAngleRadAxis(Math.toRadians(angle), x, y, z); }
/** * Creates a new quaternion from the rotation float angle in degrees around the axis vector. * * @param angle The rotation angle in degrees * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleDegAxis(float angle, Vector3d axis) { return fromAngleRadAxis(Math.toRadians(angle), axis); }
/** * Creates a new quaternion from the rotation double angle in degrees around the axis vector. * * @param angle The rotation angle in degrees * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleDegAxis(double angle, Vector3d axis) { return fromAngleRadAxis((double) Math.toRadians(angle), axis); }
/** * Creates a new quaternion from the rotation double angle in degrees around the axis vector double components. * * @param angle The rotation angle in degrees * @param x The x component of the axis vector * @param y The y component of the axis vector * @param z The z component of the axis vector * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleDegAxis(double angle, double x, double y, double z) { return fromAngleRadAxis((double) Math.toRadians(angle), x, y, z); }
/** * Creates a new quaternion from the rotation float angle in degrees around the axis vector. * * @param angle The rotation angle in degrees * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleDegAxis(float angle, Vector3d axis) { return fromAngleRadAxis(Math.toRadians(angle), axis); }
/** * Creates a new quaternion from the rotation double angle in degrees around the axis vector. * * @param angle The rotation angle in degrees * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleDegAxis(double angle, Vector3d axis) { return fromAngleRadAxis((double) Math.toRadians(angle), axis); }
/** * Creates a new quaternion from the rotation double angle in degrees around the axis vector double components. * * @param angle The rotation angle in degrees * @param x The x component of the axis vector * @param y The y component of the axis vector * @param z The z component of the axis vector * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleDegAxis(double angle, double x, double y, double z) { return fromAngleRadAxis((double) Math.toRadians(angle), x, y, z); }
/** * Creates a new quaternion from the rotation float angle in degrees around the axis vector float components. * * @param angle The rotation angle in degrees * @param x The x component of the axis vector * @param y The y component of the axis vector * @param z The z component of the axis vector * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleDegAxis(float angle, float x, float y, float z) { return fromAngleRadAxis(Math.toRadians(angle), x, y, z); }
/** * Creates a new quaternion from the double angles in radians around the x, y and z axes. * * @param pitch The rotation around x * @param yaw The rotation around y * @param roll The rotation around z * @return The quaternion defined by the rotations around the axes */ public static Quaterniond fromAxesAnglesRad(double pitch, double yaw, double roll) { return Quaterniond.fromAngleRadAxis(yaw, Vector3d.UNIT_Y). mul(Quaterniond.fromAngleRadAxis(pitch, Vector3d.UNIT_X)). mul(Quaterniond.fromAngleRadAxis(roll, Vector3d.UNIT_Z)); }
/** * Creates a new quaternion from the double angles in radians around the x, y and z axes. * * @param pitch The rotation around x * @param yaw The rotation around y * @param roll The rotation around z * @return The quaternion defined by the rotations around the axes */ public static Quaterniond fromAxesAnglesRad(double pitch, double yaw, double roll) { return Quaterniond.fromAngleRadAxis(yaw, Vector3d.UNIT_Y). mul(Quaterniond.fromAngleRadAxis(pitch, Vector3d.UNIT_X)). mul(Quaterniond.fromAngleRadAxis(roll, Vector3d.UNIT_Z)); }
/** * Converts this complex to a quaternion by * using the provided double components vector * as a rotation axis. * * @param x The x component of the axis vector * @param y The y component of the axis vector * @param z The z component of the axis vector * @return A quaternion of this rotation around the given axis */ public Quaterniond toQuaternion(double x, double y, double z) { return Quaterniond.fromAngleRadAxis(getAngleRad(), x, y, z); }
/** * Converts this complex to a quaternion by * using the provided double components vector * as a rotation axis. * * @param x The x component of the axis vector * @param y The y component of the axis vector * @param z The z component of the axis vector * @return A quaternion of this rotation around the given axis */ public Quaterniond toQuaternion(double x, double y, double z) { return Quaterniond.fromAngleRadAxis(getAngleRad(), x, y, z); }
/** * Creates a new quaternion from the rotation double angle in radians around the axis vector. * * @param angle The rotation angle in radians * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleRadAxis(double angle, Vector3d axis) { return fromAngleRadAxis(angle, axis.getX(), axis.getY(), axis.getZ()); }
/** * Creates a new quaternion from the rotation double angle in radians around the axis vector. * * @param angle The rotation angle in radians * @param axis The axis of rotation * @return The quaternion defined by the rotation around the axis */ public static Quaterniond fromAngleRadAxis(double angle, Vector3d axis) { return fromAngleRadAxis(angle, axis.getX(), axis.getY(), axis.getZ()); }
/** * Creates a new quaternion from the angle-axis rotation defined from the first to the second vector. * * @param from The first vector * @param to The second vector * @return The quaternion defined by the angle-axis rotation between the vectors */ public static Quaterniond fromRotationTo(Vector3d from, Vector3d to) { return Quaterniond.fromAngleRadAxis(TrigMath.acos(from.dot(to) / (from.length() * to.length())), from.cross(to)); }
/** * Creates a new quaternion from the angle-axis rotation defined from the first to the second vector. * * @param from The first vector * @param to The second vector * @return The quaternion defined by the angle-axis rotation between the vectors */ public static Quaterniond fromRotationTo(Vector3d from, Vector3d to) { return Quaterniond.fromAngleRadAxis(TrigMath.acos(from.dot(to) / (from.length() * to.length())), from.cross(to)); }