Returns a Quaternion.
Options
:add^Quaternion quaternion
Add the x,y,z,w components of the passed in quaternion to the ones of this quaternion
:add^float qx, ^float qy, ^float qz, ^float qw
Add the x,y,z,w components of the passed in quaternion to the ones of this quaternion
:conjugate
Conjugate the quaternion.
:cpy
:dot^Quaternion other
Get the dot product between this and the other quaternion (commutative).
:dot^float x, ^float y, ^float z, ^float w
Get the dot product between this and the other quaternion (commutative).
:equals^Object obj
:exp^float alpha
Calculates (this quaternion)^alpha where alpha is a real number and stores the result in this quaternion.
See http://en.wikipedia.org/wiki/Quaternion#Exponential.2C_logarithm.2C_and_power
:get-angle
Get the angle in degrees of the rotation this quaternion represents. Use {@link #getAxisAngle(Vector3)} to get both the axis
and the angle of this rotation. Use {@link #getAngleAround(Vector3)} to get the angle around a specific axis.
:get-angle-around^float axis-x, ^float axis-y, ^float axis-z
Get the angle in degrees of the rotation around the specified axis. The axis must be normalized.
:get-angle-around^Vector3 axis
Get the angle in degrees of the rotation around the specified axis. The axis must be normalized.
:get-angle-around-rad^float axis-x, ^float axis-y, ^float axis-z
Get the angle in radians of the rotation around the specified axis. The axis must be normalized.
:get-angle-around-rad^Vector3 axis
Get the angle in radians of the rotation around the specified axis. The axis must be normalized.
:get-angle-rad
Get the angle in radians of the rotation this quaternion represents. Does not normalize the quaternion. Use
{@link #getAxisAngleRad(Vector3)} to get both the axis and the angle of this rotation. Use
{@link #getAngleAroundRad(Vector3)} to get the angle around a specific axis.
:get-axis-angle^Vector3 axis
Get the axis angle representation of the rotation in degrees. The supplied vector will receive the axis (x, y and z values)
of the rotation and the value returned is the angle in degrees around that axis. Note that this method will alter the
supplied vector, the existing value of the vector is ignored. This will normalize this quaternion if needed. The
received axis is a unit vector. However, if this is an identity quaternion (no rotation), then the length of the axis may be
zero.
:get-axis-angle-rad^Vector3 axis
Get the axis-angle representation of the rotation in radians. The supplied vector will receive the axis (x, y and z values)
of the rotation and the value returned is the angle in radians around that axis. Note that this method will alter the
supplied vector, the existing value of the vector is ignored. This will normalize this quaternion if needed. The
received axis is a unit vector. However, if this is an identity quaternion (no rotation), then the length of the axis may be
zero.
:get-gimbal-pole
Get the pole of the gimbal lock, if any.
:get-pitch
Get the pitch euler angle in degrees, which is the rotation around the x axis. Requires that this quaternion is normalized.
:get-pitch-rad
Get the pitch euler angle in radians, which is the rotation around the x axis. Requires that this quaternion is normalized.
:get-roll
Get the roll euler angle in degrees, which is the rotation around the z axis. Requires that this quaternion is normalized.
:get-roll-rad
Get the roll euler angle in radians, which is the rotation around the z axis. Requires that this quaternion is normalized.
:get-swing-twist^float axis-x, ^float axis-y, ^float axis-z, ^Quaternion swing, ^Quaternion twist
Get the swing rotation and twist rotation for the specified axis. The twist rotation represents the rotation around the
specified axis. The swing rotation represents the rotation of the specified axis itself, which is the rotation around an
axis perpendicular to the specified axis.
The swing and twist rotation can be used to reconstruct the original quaternion: this = swing * twist
:get-swing-twist^Vector3 axis, ^Quaternion swing, ^Quaternion twist
Get the swing rotation and twist rotation for the specified axis. The twist rotation represents the rotation around the
specified axis. The swing rotation represents the rotation of the specified axis itself, which is the rotation around an
axis perpendicular to the specified axis.
The swing and twist rotation can be used to reconstruct the original quaternion: this = swing * twist
:get-yaw
Get the yaw euler angle in degrees, which is the rotation around the y axis. Requires that this quaternion is normalized.
:get-yaw-rad
Get the yaw euler angle in radians, which is the rotation around the y axis. Requires that this quaternion is normalized.
:hash-code
:idt
Sets the quaternion to an identity Quaternion
:is-identity
:is-identity^float tolerance
:len
:len2
:mul^Quaternion other
Multiplies this quaternion with another one in the form of this = this * other
:mul^float x, ^float y, ^float z, ^float w
Multiplies this quaternion with another one in the form of this = this * other
:mul^float scalar
Multiplies the components of this quaternion with the given scalar.
:mul-left^Quaternion other
Multiplies this quaternion with another one in the form of this = other * this
:mul-left^float x, ^float y, ^float z, ^float w
Multiplies this quaternion with another one in the form of this = other * this
:nor
Normalizes this quaternion to unit length
:set^float x, ^float y, ^float z, ^float w
Sets the components of the quaternion
:set^Quaternion quaternion
Sets the quaternion components from the given quaternion.
:set^Vector3 axis, ^float angle
Sets the quaternion components from the given axis and angle around that axis.
:set-euler-angles^float yaw, ^float pitch, ^float roll
Sets the quaternion to the given euler angles in degrees.
:set-euler-angles-rad^float yaw, ^float pitch, ^float roll
Sets the quaternion to the given euler angles in radians.
:set-from-axes^float xx, ^float xy, ^float xz, ^float yx, ^float yy, ^float yz, ^float zx, ^float zy, ^float zz
Sets the Quaternion from the given x-, y- and z-axis which have to be orthonormal.
Taken from Bones framework for JPCT, see http://www.aptalkarga.com/bones/ which in turn took it from Graphics Gem code at ftp://ftp.cis.upenn.edu/pub/graphics/shoemake/quatut.ps.Z.
:set-from-axes^boolean normalize-axes, ^float xx, ^float xy, ^float xz, ^float yx, ^float yy, ^float yz, ^float zx, ^float zy, ^float zz
Sets the Quaternion from the given x-, y- and z-axis.
Taken from Bones framework for JPCT, see http://www.aptalkarga.com/bones/ which in turn took it from Graphics Gem code at ftp://ftp.cis.upenn.edu/pub/graphics/shoemake/quatut.ps.Z.
:set-from-axis^Vector3 axis, ^float degrees
Sets the quaternion components from the given axis and angle around that axis.
:set-from-axis^float x, ^float y, ^float z, ^float degrees
Sets the quaternion components from the given axis and angle around that axis.
:set-from-axis-rad^Vector3 axis, ^float radians
Sets the quaternion components from the given axis and angle around that axis.
:set-from-axis-rad^float x, ^float y, ^float z, ^float radians
Sets the quaternion components from the given axis and angle around that axis.
:set-from-cross^Vector3 v1, ^Vector3 v2
Set this quaternion to the rotation between two vectors.
:set-from-cross^float x1, ^float y1, ^float z1, ^float x2, ^float y2, ^float z2
Set this quaternion to the rotation between two vectors.
:set-from-matrix^boolean normalize-axes, ^Matrix4 matrix
Sets the Quaternion from the given matrix, optionally removing any scaling.
:set-from-matrix^Matrix4 matrix
Sets the Quaternion from the given rotation matrix, which must not contain scaling.
:set-from-matrix^boolean normalize-axes, ^Matrix3 matrix
Sets the Quaternion from the given matrix, optionally removing any scaling.
:set-from-matrix^Matrix3 matrix
Sets the Quaternion from the given rotation matrix, which must not contain scaling.
:slerp^Quaternion end, ^float alpha
Spherical linear interpolation between this quaternion and the other quaternion, based on the alpha value in the range
[0,1]. Taken from Bones framework for JPCT, see http://www.aptalkarga.com/bones/
:slerp^com.badlogic.gdx.math.Quaternion[] q
Spherical linearly interpolates multiple quaternions and stores the result in this Quaternion.
Will not destroy the data previously inside the elements of q.
result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where w_i=1/n.
:slerp^com.badlogic.gdx.math.Quaternion[] q, ^float[] w
Spherical linearly interpolates multiple quaternions by the given weights and stores the result in this Quaternion.
Will not destroy the data previously inside the elements of q or w.
result = (q_1^w_1)*(q_2^w_2)* ... *(q_n^w_n) where the sum of w_i is 1.
Lists must be equal in length.
:to-matrix^float[] matrix
Fills a 4x4 matrix with the rotation matrix represented by this quaternion.
:to-string
:transform^Vector3 v
Transforms the given vector using this quaternion
Source
(defn quaternion* ([] (Quaternion.)) ([w x y z] (Quaternion. w x y z)))
(defmacro quaternion [w x y z & options] `(u/calls! ^Quaternion (quaternion* ~w ~x ~y ~z) ~@options))