Top Fields Constructors Methods
org.lwjgl.util.vector

public Class Quaternion

extends Vector
implements ReadableVector4f
Class Inheritance
All Implemented Interfaces
org.lwjgl.util.vector.ReadableVector4f, org.lwjgl.util.vector.ReadableVector3f, org.lwjgl.util.vector.ReadableVector2f, org.lwjgl.util.vector.ReadableVector
Imports
java.nio.FloatBuffer

Field Summary

Modifier and TypeField and Description
private static final long
public float
w

public float
x

public float
y

public float
z

Constructor Summary

AccessConstructor and Description
public
Quaternion()

C'tor.

public
public
Quaternion(float x, float y, float z, float w)

C'tor

Method Summary

Modifier and TypeMethod and Description
public static float

Returns:

left dot right
dot
(Quaternion
The LHS quat
left
,
Quaternion
The RHS quat
right
)

The dot product of two quaternions

public float
public final float
public final float
public float
public float

Returns:

the length squared of the quaternion
lengthSquared
()

Implements abstract org.lwjgl.util.vector.Vector.lengthSquared.

Implements org.lwjgl.util.vector.ReadableVector.lengthSquared.

public Vector
load(FloatBuffer
The buffer to load it from, at the current position
buf
)

Implements abstract org.lwjgl.util.vector.Vector.load.

Load this vector from a FloatBuffer
public static Quaternion
mul(Quaternion
the first quaternion
left
,
Quaternion
the second quaternion
right
,
Quaternion dest)

Sets the value of this quaternion to the quaternion product of quaternions left and right (this = left * right).

public static Quaternion
mulInverse(Quaternion
the left quaternion
left
,
Quaternion
the right quaternion
right
,
Quaternion dest)

Multiplies quaternion left by the inverse of quaternion right and places the value into this quaternion.

public Quaternion
negate(Quaternion
The quaternion which should be set to the conjugate of this quaternion
dest
)

Calculate the conjugate of this quaternion and put it into the given one

public static Quaternion
negate(Quaternion
The source quaternion
src
,
Quaternion
The quaternion which should be set to the conjugate of this quaternion
dest
)

Calculate the conjugate of this quaternion and put it into the given one

public Vector
negate()

Implements abstract org.lwjgl.util.vector.Vector.negate.

Calculate the conjugate of this quaternion
public static Quaternion

Returns:

The normalised quaternion
normalise
(Quaternion
The source quaternion
src
,
Quaternion
The destination quaternion, or null if a new quaternion is to be created
dest
)

Normalise the source quaternion and place the result in another quaternion.

public Quaternion

Returns:

the normalised quaternion
normalise
(Quaternion
The destination quaternion, or null if a new quaternion is to be created
dest
)

Normalise this quaternion and place the result in another quaternion.

public Vector
scale(float
The scale factor
scale
)

Implements abstract org.lwjgl.util.vector.Vector.scale.

Scale this vector
public static Quaternion

Returns:

The scaled quaternion
scale
(float
The amount to scale by
scale
,
Quaternion
The source quaternion
src
,
Quaternion
The destination quaternion, or null if a new quaternion is to be created
dest
)

Scale the source quaternion by scale and put the result in the destination

public void
set(float x, float y)

public void
set(float x, float y, float z)

public void
set(float x, float y, float z, float w)

public Quaternion

Returns:

this
set
(ReadableVector4f
The source vector
src
)

Load from another Vector4f

public final void
setFromAxisAngle(Vector4f
the axis-angle: (x,y,z) is the axis and w is the angle
a1
)

Sets the value of this quaternion to the equivalent rotation of the Axis-Angle argument.

private Quaternion
setFromMat(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)

Private method to perform the matrix-to-quaternion conversion

public final Quaternion

Returns:

this
setFromMatrix
(Matrix4f
The matrix
m
)

Sets the value of this quaternion using the rotational component of the passed matrix.

public static Quaternion

Returns:

q
setFromMatrix
(Matrix4f
The source matrix
m
,
Quaternion
The destination quaternion, or null if a new quaternion is to be created
q
)

Sets the value of the source quaternion using the rotational component of the passed matrix.

public final Quaternion
setFromMatrix(Matrix3f
The source matrix
m
)

Sets the value of this quaternion using the rotational component of the passed matrix.

public static Quaternion

Returns:

q
setFromMatrix
(Matrix3f
The source matrix
m
,
Quaternion
The destination quaternion, or null if a new quaternion is to be created
q
)

Sets the value of the source quaternion using the rotational component of the passed matrix.

public Quaternion

Returns:

this
setIdentity
()

Set this quaternion to the multiplication identity.

public static Quaternion

Returns:

q
setIdentity
(Quaternion
The quaternion
q
)

Set the given quaternion to the multiplication identity.

public void
setW(float w)

Set W

public final void
setX(float x)

Set X

public final void
setY(float y)

Set Y

public void
setZ(float z)

Set Z

public Vector
store(FloatBuffer
The buffer to store it in, at the current position
buf
)

Implements abstract org.lwjgl.util.vector.Vector.store.

Implements org.lwjgl.util.vector.ReadableVector.store.

Store this vector in a FloatBuffer
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.lwjgl.util.vector.Vector:
lengthnormalise

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID
wback to summary
public float w
xback to summary
public float x
yback to summary
public float y
zback to summary
public float z

Constructor Detail

Quaternionback to summary
public Quaternion()

C'tor. The quaternion will be initialized to the identity.

Quaternionback to summary
public Quaternion(ReadableVector4f src)

C'tor

Quaternionback to summary
public Quaternion(float x, float y, float z, float w)

C'tor

Method Detail

dotback to summary
public static float dot(Quaternion left, Quaternion right)

The dot product of two quaternions

Parameters
left:Quaternion

The LHS quat

right:Quaternion

The RHS quat

Returns:float

left dot right

getWback to summary
public float getW()

Implements org.lwjgl.util.vector.ReadableVector4f.getW.

Returns:float

Doc from org.lwjgl.util.vector.ReadableVector4f.getW.

w

getXback to summary
public final float getX()

Implements org.lwjgl.util.vector.ReadableVector2f.getX.

Returns:float

x

getYback to summary
public final float getY()

Implements org.lwjgl.util.vector.ReadableVector2f.getY.

Returns:float

y

getZback to summary
public float getZ()

Implements org.lwjgl.util.vector.ReadableVector3f.getZ.

Returns:float

Doc from org.lwjgl.util.vector.ReadableVector3f.getZ.

z

lengthSquaredback to summary
public float lengthSquared()

Implements abstract org.lwjgl.util.vector.Vector.lengthSquared.

Implements org.lwjgl.util.vector.ReadableVector.lengthSquared.

Returns:float

the length squared of the quaternion

loadback to summary
public Vector load(FloatBuffer buf)

Implements abstract org.lwjgl.util.vector.Vector.load.

Doc from org.lwjgl.util.vector.Vector.load.

Load this vector from a FloatBuffer

Parameters
buf:FloatBuffer

The buffer to load it from, at the current position

Returns:Vector

this

mulback to summary
public static Quaternion mul(Quaternion left, Quaternion right, Quaternion dest)

Sets the value of this quaternion to the quaternion product of quaternions left and right (this = left * right). Note that this is safe for aliasing (e.g. this can be left or right).

Parameters
left:Quaternion

the first quaternion

right:Quaternion

the second quaternion

mulInverseback to summary
public static Quaternion mulInverse(Quaternion left, Quaternion right, Quaternion dest)

Multiplies quaternion left by the inverse of quaternion right and places the value into this quaternion. The value of both argument quaternions is preservered (this = left * right^-1).

Parameters
left:Quaternion

the left quaternion

right:Quaternion

the right quaternion

negateback to summary
public Quaternion negate(Quaternion dest)

Calculate the conjugate of this quaternion and put it into the given one

Parameters
dest:Quaternion

The quaternion which should be set to the conjugate of this quaternion

negateback to summary
public static Quaternion negate(Quaternion src, Quaternion dest)

Calculate the conjugate of this quaternion and put it into the given one

Parameters
src:Quaternion

The source quaternion

dest:Quaternion

The quaternion which should be set to the conjugate of this quaternion

negateback to summary
public Vector negate()

Implements abstract org.lwjgl.util.vector.Vector.negate.

Calculate the conjugate of this quaternion

Returns:Vector

Doc from org.lwjgl.util.vector.Vector.negate.

this

normaliseback to summary
public static Quaternion normalise(Quaternion src, Quaternion dest)

Normalise the source quaternion and place the result in another quaternion.

Parameters
src:Quaternion

The source quaternion

dest:Quaternion

The destination quaternion, or null if a new quaternion is to be created

Returns:Quaternion

The normalised quaternion

normaliseback to summary
public Quaternion normalise(Quaternion dest)

Normalise this quaternion and place the result in another quaternion.

Parameters
dest:Quaternion

The destination quaternion, or null if a new quaternion is to be created

Returns:Quaternion

the normalised quaternion

scaleback to summary
public Vector scale(float scale)

Implements abstract org.lwjgl.util.vector.Vector.scale.

Doc from org.lwjgl.util.vector.Vector.scale.

Scale this vector

Parameters
scale:float

The scale factor

Returns:Vector

this

scaleback to summary
public static Quaternion scale(float scale, Quaternion src, Quaternion dest)

Scale the source quaternion by scale and put the result in the destination

Parameters
scale:float

The amount to scale by

src:Quaternion

The source quaternion

dest:Quaternion

The destination quaternion, or null if a new quaternion is to be created

Returns:Quaternion

The scaled quaternion

setback to summary
public void set(float x, float y)
setback to summary
public void set(float x, float y, float z)
setback to summary
public void set(float x, float y, float z, float w)
setback to summary
public Quaternion set(ReadableVector4f src)

Load from another Vector4f

Parameters
src:ReadableVector4f

The source vector

Returns:Quaternion

this

setFromAxisAngleback to summary
public final void setFromAxisAngle(Vector4f a1)

Sets the value of this quaternion to the equivalent rotation of the Axis-Angle argument.

Parameters
a1:Vector4f

the axis-angle: (x,y,z) is the axis and w is the angle

setFromMatback to summary
private Quaternion setFromMat(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)

Private method to perform the matrix-to-quaternion conversion

setFromMatrixback to summary
public final Quaternion setFromMatrix(Matrix4f m)

Sets the value of this quaternion using the rotational component of the passed matrix.

Parameters
m:Matrix4f

The matrix

Returns:Quaternion

this

setFromMatrixback to summary
public static Quaternion setFromMatrix(Matrix4f m, Quaternion q)

Sets the value of the source quaternion using the rotational component of the passed matrix.

Parameters
m:Matrix4f

The source matrix

q:Quaternion

The destination quaternion, or null if a new quaternion is to be created

Returns:Quaternion

q

setFromMatrixback to summary
public final Quaternion setFromMatrix(Matrix3f m)

Sets the value of this quaternion using the rotational component of the passed matrix.

Parameters
m:Matrix3f

The source matrix

setFromMatrixback to summary
public static Quaternion setFromMatrix(Matrix3f m, Quaternion q)

Sets the value of the source quaternion using the rotational component of the passed matrix.

Parameters
m:Matrix3f

The source matrix

q:Quaternion

The destination quaternion, or null if a new quaternion is to be created

Returns:Quaternion

q

setIdentityback to summary
public Quaternion setIdentity()

Set this quaternion to the multiplication identity.

Returns:Quaternion

this

setIdentityback to summary
public static Quaternion setIdentity(Quaternion q)

Set the given quaternion to the multiplication identity.

Parameters
q:Quaternion

The quaternion

Returns:Quaternion

q

setWback to summary
public void setW(float w)

Set W

setXback to summary
public final void setX(float x)

Set X

setYback to summary
public final void setY(float y)

Set Y

setZback to summary
public void setZ(float z)

Set Z

storeback to summary
public Vector store(FloatBuffer buf)

Implements abstract org.lwjgl.util.vector.Vector.store.

Implements org.lwjgl.util.vector.ReadableVector.store.

Doc from org.lwjgl.util.vector.ReadableVector.store.

Store this vector in a FloatBuffer

Parameters
buf:FloatBuffer

The buffer to store it in, at the current position

Returns:Vector

this

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object