|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.badlogic.gdx.math.Quaternion
public class Quaternion
A simple quaternion class. See http://en.wikipedia.org/wiki/Quaternion for more information.
Field Summary | |
---|---|
float |
w
|
float |
x
|
float |
y
|
float |
z
|
Constructor Summary | |
---|---|
Quaternion()
|
|
Quaternion(float x,
float y,
float z,
float w)
Constructor, sets the four components of the quaternion. |
|
Quaternion(Quaternion quaternion)
Constructor, sets the quaternion components from the given quaternion. |
|
Quaternion(Vector3 axis,
float angle)
Constructor, sets the quaternion from the given axis vector and the angle around that axis in degrees. |
Method Summary | |
---|---|
Quaternion |
conjugate()
Conjugate the quaternion. |
Quaternion |
cpy()
|
float |
dot(Quaternion other)
Dot product between this and the other quaternion. |
boolean |
equals(Object o)
|
float |
getAxisAngle(Vector3 axis)
Get the angle and the axis of rotation |
Quaternion |
idt()
Sets the quaternion to an identity Quaternion |
float |
len()
|
float |
len2()
|
Quaternion |
mul(float scalar)
Multiplies the components of this quaternion with the given scalar. |
Quaternion |
mul(Quaternion q)
Multiplies this quaternion with another one |
Quaternion |
mulLeft(Quaternion q)
Multiplies this quaternion with another one in the form of q * this |
Quaternion |
nor()
Normalizes this quaternion to unit length |
Quaternion |
set(float x,
float y,
float z,
float w)
Sets the components of the quaternion |
Quaternion |
set(Quaternion quaternion)
Sets the quaternion components from the given quaternion. |
Quaternion |
set(Vector3 axis,
float angle)
Sets the quaternion components from the given axis and angle around that axis. |
Quaternion |
setEulerAngles(float yaw,
float pitch,
float roll)
Sets the quaternion to the given euler angles. |
Quaternion |
setFromAxes(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. |
Quaternion |
setFromAxis(float x,
float y,
float z,
float angle)
Sets the quaternion components from the given axis and angle around that axis. |
Quaternion |
setFromAxis(Vector3 axis,
float angle)
Sets the quaternion components from the given axis and angle around that axis. |
Quaternion |
setFromCross(float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
Set this quaternion to the rotation between two vectors. |
Quaternion |
setFromCross(Vector3 v1,
Vector3 v2)
Set this quaternion to the rotation between two vectors. |
Quaternion |
setFromMatrix(Matrix4 matrix)
|
Quaternion |
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]. |
void |
toMatrix(float[] matrix)
Fills a 4x4 matrix with the rotation matrix represented by this quaternion. |
String |
toString()
|
Vector3 |
transform(Vector3 v)
Transforms the given vector using this quaternion |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float x
public float y
public float z
public float w
Constructor Detail |
---|
public Quaternion(float x, float y, float z, float w)
x
- The x-componenty
- The y-componentz
- The z-componentw
- The w-componentpublic Quaternion()
public Quaternion(Quaternion quaternion)
quaternion
- The quaternion to copy.public Quaternion(Vector3 axis, float angle)
axis
- The axisangle
- The angle in degrees.Method Detail |
---|
public Quaternion set(float x, float y, float z, float w)
x
- The x-componenty
- The y-componentz
- The z-componentw
- The w-component
public Quaternion set(Quaternion quaternion)
quaternion
- The quaternion.
public Quaternion set(Vector3 axis, float angle)
axis
- The axisangle
- The angle in degrees
public Quaternion cpy()
public float len()
public String toString()
toString
in class Object
public Quaternion setEulerAngles(float yaw, float pitch, float roll)
yaw
- the yaw in degreespitch
- the pitch in degressroll
- the roll in degess
public float len2()
public Quaternion nor()
public Quaternion conjugate()
public Vector3 transform(Vector3 v)
v
- Vector to transformpublic Quaternion mul(Quaternion q)
q
- Quaternion to multiply with
public Quaternion mulLeft(Quaternion q)
q
- Quaternion to multiply with
public void toMatrix(float[] matrix)
matrix
- Matrix to fillpublic Quaternion idt()
public Quaternion setFromAxis(Vector3 axis, float angle)
axis
- The axisangle
- The angle in degrees
public Quaternion setFromAxis(float x, float y, float z, float angle)
x
- X direction of the axisy
- Y direction of the axisz
- Z direction of the axisangle
- The angle in degrees
public Quaternion setFromMatrix(Matrix4 matrix)
public Quaternion setFromAxes(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.
xx
- x-axis x-coordinatexy
- x-axis y-coordinatexz
- x-axis z-coordinateyx
- y-axis x-coordinateyy
- y-axis y-coordinateyz
- y-axis z-coordinatezx
- z-axis x-coordinatezy
- z-axis y-coordinatezz
- z-axis z-coordinatepublic Quaternion setFromCross(Vector3 v1, Vector3 v2)
v1
- The base vector, which should be normalized.v2
- The target vector, which should be normalized.
public Quaternion setFromCross(float x1, float y1, float z1, float x2, float y2, float z2)
x1
- The base vectors x value, which should be normalized.y1
- The base vectors y value, which should be normalized.z1
- The base vectors z value, which should be normalized.x2
- The target vector x value, which should be normalized.y2
- The target vector y value, which should be normalized.z2
- The target vector z value, which should be normalized.
public Quaternion slerp(Quaternion end, float alpha)
end
- the end quaternionalpha
- alpha in the range [0,1]
public boolean equals(Object o)
equals
in class Object
public float dot(Quaternion other)
other
- the other quaternion.
public Quaternion mul(float scalar)
scalar
- the scalar.
public float getAxisAngle(Vector3 axis)
axis
- axis to get
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |