public class Quaternionf extends Object implements Imaginaryf, Comparable<Quaternionf>, Serializable, Cloneable
xi + yj + zk + w. The x, y, z and w components are stored as floats. This class is immutable.| Modifier and Type | Field and Description |
|---|---|
static Quaternionf |
IDENTITY
An immutable identity (0, 0, 0, 1) quaternion.
|
static Quaternionf |
ZERO
An immutable identity (0, 0, 0, 0) quaternion.
|
| Constructor and Description |
|---|
Quaternionf()
Constructs a new quaternion.
|
Quaternionf(double x,
double y,
double z,
double w)
Constructs a new quaternion from the double components.
|
Quaternionf(float x,
float y,
float z,
float w)
Constructs a new quaternion from the float components.
|
Quaternionf(Quaternionf q)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Quaternionf |
add(double x,
double y,
double z,
double w)
Adds the double components of another quaternion to this one.
|
Quaternionf |
add(float x,
float y,
float z,
float w)
Adds the float components of another quaternion to this one.
|
Quaternionf |
add(Quaternionf q)
Adds another quaternion to this one.
|
Quaternionf |
clone() |
int |
compareTo(Quaternionf q) |
Quaternionf |
conjugate()
Conjugates the quaternion.
|
Quaternionf |
div(double a)
Divides the components of this quaternion by a double scalar.
|
Quaternionf |
div(double x,
double y,
double z,
double w)
Divides this quaternions by the double components of another one.
|
Quaternionf |
div(float a)
Divides the components of this quaternion by a float scalar.
|
Quaternionf |
div(float x,
float y,
float z,
float w)
Divides this quaternions by the float components of another one.
|
Quaternionf |
div(Quaternionf q)
Divides this quaternions by another one.
|
float |
dot(double x,
double y,
double z,
double w)
Returns the dot product of this quaternion with the double components of another one.
|
float |
dot(float x,
float y,
float z,
float w)
Returns the dot product of this quaternion with the float components of another one.
|
float |
dot(Quaternionf q)
Returns the dot product of this quaternion with another one.
|
boolean |
equals(Object o) |
static Quaternionf |
from(float x,
float y,
float z,
float w)
Creates a new quaternion from the float components.
|
static Quaternionf |
fromAngleDegAxis(double angle,
double x,
double y,
double z)
Creates a new quaternion from the rotation double angle in degrees around the axis vector double components.
|
static Quaternionf |
fromAngleDegAxis(double angle,
Vector3f axis)
Creates a new quaternion from the rotation double angle in degrees around the axis vector.
|
static Quaternionf |
fromAngleDegAxis(float angle,
float x,
float y,
float z)
Creates a new quaternion from the rotation float angle in degrees around the axis vector float components.
|
static Quaternionf |
fromAngleDegAxis(float angle,
Vector3f axis)
Creates a new quaternion from the rotation float angle in degrees around the axis vector.
|
static Quaternionf |
fromAngleRadAxis(double angle,
double x,
double y,
double z)
Creates a new quaternion from the rotation double angle in radians around the axis vector double components.
|
static Quaternionf |
fromAngleRadAxis(double angle,
Vector3f axis)
Creates a new quaternion from the rotation double angle in radians around the axis vector.
|
static Quaternionf |
fromAngleRadAxis(float angle,
float x,
float y,
float z)
Creates a new quaternion from the rotation float angle in radians around the axis vector float components.
|
static Quaternionf |
fromAngleRadAxis(float angle,
Vector3f axis)
Creates a new quaternion from the rotation float angle in radians around the axis vector.
|
static Quaternionf |
fromAxesAnglesDeg(double pitch,
double yaw,
double roll)
Creates a new quaternion from the double angles in degrees around the x, y and z axes.
|
static Quaternionf |
fromAxesAnglesDeg(float pitch,
float yaw,
float roll)
Creates a new quaternion from the float angles in degrees around the x, y and z axes.
|
static Quaternionf |
fromAxesAnglesRad(double pitch,
double yaw,
double roll)
Creates a new quaternion from the double angles in radians around the x, y and z axes.
|
static Quaternionf |
fromAxesAnglesRad(float pitch,
float yaw,
float roll)
Creates a new quaternion from the float angles in radians around the x, y and z axes.
|
static Quaternionf |
fromImaginary(float x,
float y,
float z)
Creates a new quaternion from the float imaginary components.
|
static Quaternionf |
fromReal(float w)
Creates a new quaternion from the float real component.
|
static Quaternionf |
fromRotationMatrix(Matrix3f matrix)
Creates a new quaternion from the rotation matrix.
|
static Quaternionf |
fromRotationTo(Vector3f from,
Vector3f to)
Creates a new quaternion from the angle-axis rotation defined from the first to the second vector.
|
Vector3f |
getAxesAnglesDeg()
Returns the angles in degrees around the x, y and z axes that correspond to the rotation represented by this quaternion.
|
Vector3f |
getAxesAnglesRad()
Returns the angles in radians around the x, y and z axes that correspond to the rotation represented by this quaternion.
|
Vector3f |
getAxis()
Returns the axis of rotation for this quaternion.
|
Vector3f |
getDirection()
Returns a unit vector representing the direction of this quaternion, which is
Vector3f.FORWARD rotated by this quaternion. |
float |
getW()
Gets the w (real) component of this quaternion.
|
float |
getX()
Gets the x (imaginary) component of this quaternion.
|
float |
getY()
Gets the y (imaginary) component of this quaternion.
|
float |
getZ()
Gets the z (imaginary) component of this quaternion.
|
int |
hashCode() |
Quaternionf |
invert()
Inverts the quaternion.
|
float |
length()
Returns the length of this quaternion.
|
float |
lengthSquared()
Returns the square of the length of this quaternion.
|
Quaternionf |
mul(double a)
Multiplies the components of this quaternion by a double scalar.
|
Quaternionf |
mul(double x,
double y,
double z,
double w)
Multiplies the double components of another quaternion with this one.
|
Quaternionf |
mul(float a)
Multiplies the components of this quaternion by a float scalar.
|
Quaternionf |
mul(float x,
float y,
float z,
float w)
Multiplies the float components of another quaternion with this one.
|
Quaternionf |
mul(Quaternionf q)
Multiplies another quaternion with this one.
|
Quaternionf |
normalize()
Normalizes this quaternion.
|
Vector3f |
rotate(double x,
double y,
double z)
Rotates the double components of a vector by this quaternion.
|
Vector3f |
rotate(float x,
float y,
float z)
Rotates the float components of a vector by this quaternion.
|
Vector3f |
rotate(Vector3f v)
Rotates a vector by this quaternion.
|
Quaternionf |
sub(double x,
double y,
double z,
double w)
Subtracts the double components of another quaternion from this one.
|
Quaternionf |
sub(float x,
float y,
float z,
float w)
Subtracts the float components of another quaternion from this one.
|
Quaternionf |
sub(Quaternionf q)
Subtracts another quaternion from this one.
|
Complexf |
toComplex()
Converts this quaternion to a complex by extracting the rotation around
the axis and returning it as a rotation in the plane perpendicular to the
rotation axis.
|
Quaterniond |
toDouble() |
Quaternionf |
toFloat() |
String |
toString() |
public static final Quaternionf ZERO
public static final Quaternionf IDENTITY
public Quaternionf()
public Quaternionf(double x,
double y,
double z,
double w)
x - The x (imaginary) componenty - The y (imaginary) componentz - The z (imaginary) componentw - The w (real) componentpublic Quaternionf(float x,
float y,
float z,
float w)
x - The x (imaginary) componenty - The y (imaginary) componentz - The z (imaginary) componentw - The w (real) componentpublic Quaternionf(Quaternionf q)
q - The quaternion to copypublic float getX()
public float getY()
public float getZ()
public float getW()
public Quaternionf add(Quaternionf q)
q - The quaternion to addpublic Quaternionf add(double x, double y, double z, double w)
x - The x (imaginary) component of the quaternion to addy - The y (imaginary) component of the quaternion to addz - The z (imaginary) component of the quaternion to addw - The w (real) component of the quaternion to addpublic Quaternionf add(float x, float y, float z, float w)
x - The x (imaginary) component of the quaternion to addy - The y (imaginary) component of the quaternion to addz - The z (imaginary) component of the quaternion to addw - The w (real) component of the quaternion to addpublic Quaternionf sub(Quaternionf q)
q - The quaternion to subtractpublic Quaternionf sub(double x, double y, double z, double w)
x - The x (imaginary) component of the quaternion to subtracty - The y (imaginary) component of the quaternion to subtractz - The z (imaginary) component of the quaternion to subtractw - The w (real) component of the quaternion to subtractpublic Quaternionf sub(float x, float y, float z, float w)
x - The x (imaginary) component of the quaternion to subtracty - The y (imaginary) component of the quaternion to subtractz - The z (imaginary) component of the quaternion to subtractw - The w (real) component of the quaternion to subtractpublic Quaternionf mul(double a)
a - The multiplication scalarpublic Quaternionf mul(float a)
mul in interface Imaginaryfa - The multiplication scalarpublic Quaternionf mul(Quaternionf q)
q - The quaternion to multiply withpublic Quaternionf mul(double x, double y, double z, double w)
x - The x (imaginary) component of the quaternion to multiply withy - The y (imaginary) component of the quaternion to multiply withz - The z (imaginary) component of the quaternion to multiply withw - The w (real) component of the quaternion to multiply withpublic Quaternionf mul(float x, float y, float z, float w)
x - The x (imaginary) component of the quaternion to multiply withy - The y (imaginary) component of the quaternion to multiply withz - The z (imaginary) component of the quaternion to multiply withw - The w (real) component of the quaternion to multiply withpublic Quaternionf div(double a)
a - The division scalarpublic Quaternionf div(float a)
div in interface Imaginaryfa - The division scalarpublic Quaternionf div(Quaternionf q)
q - The quaternion to divide withpublic Quaternionf div(double x, double y, double z, double w)
x - The x (imaginary) component of the quaternion to divide withy - The y (imaginary) component of the quaternion to divide withz - The z (imaginary) component of the quaternion to divide withw - The w (real) component of the quaternion to divide withpublic Quaternionf div(float x, float y, float z, float w)
x - The x (imaginary) component of the quaternion to divide withy - The y (imaginary) component of the quaternion to divide withz - The z (imaginary) component of the quaternion to divide withw - The w (real) component of the quaternion to divide withpublic float dot(Quaternionf q)
q - The quaternion to calculate the dot product withpublic float dot(double x,
double y,
double z,
double w)
x - The x (imaginary) component of the quaternion to calculate the dot product withy - The y (imaginary) component of the quaternion to calculate the dot product withz - The z (imaginary) component of the quaternion to calculate the dot product withw - The w (real) component of the quaternion to calculate the dot product withpublic float dot(float x,
float y,
float z,
float w)
x - The x (imaginary) component of the quaternion to calculate the dot product withy - The y (imaginary) component of the quaternion to calculate the dot product withz - The z (imaginary) component of the quaternion to calculate the dot product withw - The w (real) component of the quaternion to calculate the dot product withpublic Vector3f rotate(Vector3f v)
v - The vector to rotatepublic Vector3f rotate(double x, double y, double z)
x - The x component of the vectory - The y component of the vectorz - The z component of the vectorpublic Vector3f rotate(float x, float y, float z)
x - The x component of the vectory - The y component of the vectorz - The z component of the vectorpublic Vector3f getDirection()
Vector3f.FORWARD rotated by this quaternion.public Vector3f getAxis()
public Vector3f getAxesAnglesDeg()
public Vector3f getAxesAnglesRad()
public Quaternionf conjugate()
a is an operation returning quaternion a' such that a' * a = a * a' = |a|2 where
|a|2 is squared length of a.conjugate in interface Imaginaryfpublic Quaternionf invert()
a returns quaternion a-1 = a' / |a|2 where a' is conjugation of a, and |a|2 is squared length of a. a, b, c, such that a * b = c equations
a-1 * c = b and c * b-1 = a are true.invert in interface Imaginaryfpublic float lengthSquared()
lengthSquared in interface Imaginaryfpublic float length()
length in interface Imaginaryfpublic Quaternionf normalize()
normalize in interface Imaginaryfpublic Complexf toComplex()
public Quaternionf toFloat()
toFloat in interface Imaginaryfpublic Quaterniond toDouble()
toDouble in interface Imaginaryfpublic int compareTo(Quaternionf q)
compareTo in interface Comparable<Quaternionf>public Quaternionf clone()
public static Quaternionf fromReal(float w)
The ZERO constant is re-used when w is 0.
w - The w (real) componentpublic static Quaternionf fromImaginary(float x, float y, float z)
The ZERO constant is re-used when x, y, and z are 0.
x - The x (imaginary) componenty - The y (imaginary) componentz - The z (imaginary) componentpublic static Quaternionf from(float x, float y, float z, float w)
The ZERO constant is re-used when x, y, z, and w are 0.
x - The x (imaginary) componenty - The y (imaginary) componentz - The z (imaginary) componentw - The w (real) componentpublic static Quaternionf fromAxesAnglesDeg(double pitch, double yaw, double roll)
pitch - The rotation around xyaw - The rotation around yroll - The rotation around zpublic static Quaternionf fromAxesAnglesRad(double pitch, double yaw, double roll)
pitch - The rotation around xyaw - The rotation around yroll - The rotation around zpublic static Quaternionf fromAxesAnglesDeg(float pitch, float yaw, float roll)
pitch - The rotation around xyaw - The rotation around yroll - The rotation around zpublic static Quaternionf fromAxesAnglesRad(float pitch, float yaw, float roll)
pitch - The rotation around xyaw - The rotation around yroll - The rotation around zpublic static Quaternionf fromRotationTo(Vector3f from, Vector3f to)
from - The first vectorto - The second vectorpublic static Quaternionf fromAngleDegAxis(double angle, Vector3f axis)
angle - The rotation angle in degreesaxis - The axis of rotationpublic static Quaternionf fromAngleRadAxis(double angle, Vector3f axis)
angle - The rotation angle in radiansaxis - The axis of rotationpublic static Quaternionf fromAngleDegAxis(float angle, Vector3f axis)
angle - The rotation angle in degreesaxis - The axis of rotationpublic static Quaternionf fromAngleRadAxis(float angle, Vector3f axis)
angle - The rotation angle in radiansaxis - The axis of rotationpublic static Quaternionf fromAngleDegAxis(double angle, double x, double y, double z)
angle - The rotation angle in degreesx - The x component of the axis vectory - The y component of the axis vectorz - The z component of the axis vectorpublic static Quaternionf fromAngleRadAxis(double angle, double x, double y, double z)
angle - The rotation angle in radiansx - The x component of the axis vectory - The y component of the axis vectorz - The z component of the axis vectorpublic static Quaternionf fromAngleDegAxis(float angle, float x, float y, float z)
angle - The rotation angle in degreesx - The x component of the axis vectory - The y component of the axis vectorz - The z component of the axis vectorpublic static Quaternionf fromAngleRadAxis(float angle, float x, float y, float z)
angle - The rotation angle in radiansx - The x component of the axis vectory - The y component of the axis vectorz - The z component of the axis vectorpublic static Quaternionf fromRotationMatrix(Matrix3f matrix)
matrix - The rotation matrixCopyright © 2013–2016 Flow Powered. All rights reserved.