/** Sets the quaternion components from the given axis and angle around that axis. * * @param axis The axis * @param radians The angle in radians * @return This quaternion for chaining. */ public Quaternion setFromAxisRad (final Vector3 axis, final float radians) { return setFromAxisRad(axis.x, axis.y, axis.z, radians); }
/** Sets the quaternion components from the given axis and angle around that axis. * * @param axis The axis * @param radians The angle in radians * @return This quaternion for chaining. */ public Quaternion setFromAxisRad (final Vector3 axis, final float radians) { return setFromAxisRad(axis.x, axis.y, axis.z, radians); }
/** Sets the quaternion components from the given axis and angle around that axis. * @param x X direction of the axis * @param y Y direction of the axis * @param z Z direction of the axis * @param degrees The angle in degrees * @return This quaternion for chaining. */ public Quaternion setFromAxis (final float x, final float y, final float z, final float degrees) { return setFromAxisRad(x, y, z, degrees * MathUtils.degreesToRadians); }
/** Sets the quaternion components from the given axis and angle around that axis. * @param x X direction of the axis * @param y Y direction of the axis * @param z Z direction of the axis * @param degrees The angle in degrees * @return This quaternion for chaining. */ public Quaternion setFromAxis (final float x, final float y, final float z, final float degrees) { return setFromAxisRad(x, y, z, degrees * MathUtils.degreesToRadians); }
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x * glTranslate/glRotate/glScale. * * @param axis The vector axis to rotate around. * @param radians The angle in radians. * @return This matrix for the purpose of chaining methods together. */ public Matrix4 rotateRad (Vector3 axis, float radians) { if (radians == 0) return this; quat.setFromAxisRad(axis, radians); return rotate(quat); }
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x * glTranslate/glRotate/glScale. * * @param axis The vector axis to rotate around. * @param radians The angle in radians. * @return This matrix for the purpose of chaining methods together. */ public Matrix4 rotateRad (Vector3 axis, float radians) { if (radians == 0) return this; quat.setFromAxisRad(axis, radians); return rotate(quat); }
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x * glTranslate/glRotate/glScale * @param axisX The x-axis component of the vector to rotate around. * @param axisY The y-axis component of the vector to rotate around. * @param axisZ The z-axis component of the vector to rotate around. * @param radians The angle in radians * @return This matrix for the purpose of chaining methods together. */ public Matrix4 rotateRad (float axisX, float axisY, float axisZ, float radians) { if (radians == 0) return this; quat.setFromAxisRad(axisX, axisY, axisZ, radians); return rotate(quat); }
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x * glTranslate/glRotate/glScale * @param axisX The x-axis component of the vector to rotate around. * @param axisY The y-axis component of the vector to rotate around. * @param axisZ The z-axis component of the vector to rotate around. * @param radians The angle in radians * @return This matrix for the purpose of chaining methods together. */ public Matrix4 rotateRad (float axisX, float axisY, float axisZ, float radians) { if (radians == 0) return this; quat.setFromAxisRad(axisX, axisY, axisZ, radians); return rotate(quat); }
/** Set this quaternion to the rotation between two vectors. * @param v1 The base vector, which should be normalized. * @param v2 The target vector, which should be normalized. * @return This quaternion for chaining */ public Quaternion setFromCross (final Vector3 v1, final Vector3 v2) { final float dot = MathUtils.clamp(v1.dot(v2), -1f, 1f); final float angle = (float)Math.acos(dot); return setFromAxisRad(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x, angle); }
/** Set this quaternion to the rotation between two vectors. * @param v1 The base vector, which should be normalized. * @param v2 The target vector, which should be normalized. * @return This quaternion for chaining */ public Quaternion setFromCross (final Vector3 v1, final Vector3 v2) { final float dot = MathUtils.clamp(v1.dot(v2), -1f, 1f); final float angle = (float)Math.acos(dot); return setFromAxisRad(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x, angle); }
/** Sets the matrix to a rotation matrix around the given axis. * * @param axis The axis * @param radians The angle in radians * @return This matrix for the purpose of chaining methods together. */ public Matrix4 setToRotationRad (Vector3 axis, float radians) { if (radians == 0) { idt(); return this; } return set(quat.setFromAxisRad(axis, radians)); }
/** Set this quaternion to the rotation between two vectors. * @param x1 The base vectors x value, which should be normalized. * @param y1 The base vectors y value, which should be normalized. * @param z1 The base vectors z value, which should be normalized. * @param x2 The target vector x value, which should be normalized. * @param y2 The target vector y value, which should be normalized. * @param z2 The target vector z value, which should be normalized. * @return This quaternion for chaining */ public Quaternion setFromCross (final float x1, final float y1, final float z1, final float x2, final float y2, final float z2) { final float dot = MathUtils.clamp(Vector3.dot(x1, y1, z1, x2, y2, z2), -1f, 1f); final float angle = (float)Math.acos(dot); return setFromAxisRad(y1 * z2 - z1 * y2, z1 * x2 - x1 * z2, x1 * y2 - y1 * x2, angle); }
/** Set this quaternion to the rotation between two vectors. * @param x1 The base vectors x value, which should be normalized. * @param y1 The base vectors y value, which should be normalized. * @param z1 The base vectors z value, which should be normalized. * @param x2 The target vector x value, which should be normalized. * @param y2 The target vector y value, which should be normalized. * @param z2 The target vector z value, which should be normalized. * @return This quaternion for chaining */ public Quaternion setFromCross (final float x1, final float y1, final float z1, final float x2, final float y2, final float z2) { final float dot = MathUtils.clamp(Vector3.dot(x1, y1, z1, x2, y2, z2), -1f, 1f); final float angle = (float)Math.acos(dot); return setFromAxisRad(y1 * z2 - z1 * y2, z1 * x2 - x1 * z2, x1 * y2 - y1 * x2, angle); }
/** Sets the matrix to a rotation matrix around the given axis. * * @param axisX The x-component of the axis * @param axisY The y-component of the axis * @param axisZ The z-component of the axis * @param radians The angle in radians * @return This matrix for the purpose of chaining methods together. */ public Matrix4 setToRotationRad (float axisX, float axisY, float axisZ, float radians) { if (radians == 0) { idt(); return this; } return set(quat.setFromAxisRad(axisX, axisY, axisZ, radians)); }
/** Sets the matrix to a rotation matrix around the given axis. * * @param axis The axis * @param radians The angle in radians * @return This matrix for the purpose of chaining methods together. */ public Matrix4 setToRotationRad (Vector3 axis, float radians) { if (radians == 0) { idt(); return this; } return set(quat.setFromAxisRad(axis, radians)); }
/** Sets the matrix to a rotation matrix around the given axis. * * @param axisX The x-component of the axis * @param axisY The y-component of the axis * @param axisZ The z-component of the axis * @param radians The angle in radians * @return This matrix for the purpose of chaining methods together. */ public Matrix4 setToRotationRad (float axisX, float axisY, float axisZ, float radians) { if (radians == 0) { idt(); return this; } return set(quat.setFromAxisRad(axisX, axisY, axisZ, radians)); }
/** Sets the quaternion components from the given axis and angle around that axis. * * @param axis The axis * @param radians The angle in radians * @return This quaternion for chaining. */ public Quaternion setFromAxisRad (final Vector3 axis, final float radians) { return setFromAxisRad(axis.x, axis.y, axis.z, radians); }
/** Sets the quaternion components from the given axis and angle around that axis. * @param x X direction of the axis * @param y Y direction of the axis * @param z Z direction of the axis * @param degrees The angle in degrees * @return This quaternion for chaining. */ public Quaternion setFromAxis (final float x, final float y, final float z, final float degrees) { return setFromAxisRad(x, y, z, degrees * MathUtils.degreesToRadians); }
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x * glTranslate/glRotate/glScale * @param axisX The x-axis component of the vector to rotate around. * @param axisY The y-axis component of the vector to rotate around. * @param axisZ The z-axis component of the vector to rotate around. * @param radians The angle in radians * @return This matrix for the purpose of chaining methods together. */ public Matrix4 rotateRad (float axisX, float axisY, float axisZ, float radians) { if (radians == 0) return this; quat.setFromAxisRad(axisX, axisY, axisZ, radians); return rotate(quat); }
/** Sets the matrix to a rotation matrix around the given axis. * * @param axis The axis * @param radians The angle in radians * @return This matrix for the purpose of chaining methods together. */ public Matrix4 setToRotationRad (Vector3 axis, float radians) { if (radians == 0) { idt(); return this; } return set(quat.setFromAxisRad(axis, radians)); }