public class Quaterniond extends Object implements Imaginaryd, Comparable<Quaterniond>, Serializable, Cloneable
xi + yj + zk + w. The x, y, z and w components are stored as doubles. This class is immutable.| Modifier and Type | Field and Description |
|---|---|
static Quaterniond |
IDENTITY
An immutable identity (0, 0, 0, 1) quaternion.
|
static Quaterniond |
ZERO
An immutable identity (0, 0, 0, 0) quaternion.
|
| Constructor and Description |
|---|
Quaterniond()
Constructs a new quaternion.
|
Quaterniond(double x,
double y,
double z,
double w)
Constructs a new quaternion from the double components.
|
Quaterniond(float x,
float y,
float z,
float w)
Constructs a new quaternion from the float components.
|
Quaterniond(Quaterniond q)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Quaterniond |
add(double x,
double y,
double z,
double w)
Adds the double components of another quaternion to this one.
|
Quaterniond |
add(float x,
float y,
float z,
float w)
Adds the float components of another quaternion to this one.
|
Quaterniond |
add(Quaterniond q)
Adds another quaternion to this one.
|
Quaterniond |
clone() |
int |
compareTo(Quaterniond q) |
Quaterniond |
conjugate()
Conjugates the quaternion.
|
Quaterniond |
div(double a)
Divides the components of this quaternion by a double scalar.
|
Quaterniond |
div(double x,
double y,
double z,
double w)
Divides this quaternions by the double components of another one.
|
Quaterniond |
div(float a)
Divides the components of this quaternion by a float scalar.
|
Quaterniond |
div(float x,
float y,
float z,
float w)
Divides this quaternions by the float components of another one.
|
Quaterniond |
div(Quaterniond q)
Divides this quaternions by another one.
|
double |
dot(double x,
double y,
double z,
double w)
Returns the dot product of this quaternion with the double components of another one.
|
double |
dot(float x,
float y,
float z,
float w)
Returns the dot product of this quaternion with the float components of another one.
|
double |
dot(Quaterniond q)
Returns the dot product of this quaternion with another one.
|
boolean |
equals(Object o) |
static Quaterniond |
from(double x,
double y,
double z,
double w)
Creates a new quaternion from the double components.
|
static Quaterniond |
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 Quaterniond |
fromAngleDegAxis(double angle,
Vector3d axis)
Creates a new quaternion from the rotation double angle in degrees around the axis vector.
|
static Quaterniond |
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 Quaterniond |
fromAngleDegAxis(float angle,
Vector3d axis)
Creates a new quaternion from the rotation float angle in degrees around the axis vector.
|
static Quaterniond |
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 Quaterniond |
fromAngleRadAxis(double angle,
Vector3d axis)
Creates a new quaternion from the rotation double angle in radians around the axis vector.
|
static Quaterniond |
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 Quaterniond |
fromAngleRadAxis(float angle,
Vector3d axis)
Creates a new quaternion from the rotation float angle in radians around the axis vector.
|
static Quaterniond |
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 Quaterniond |
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 Quaterniond |
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 Quaterniond |
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 Quaterniond |
fromImaginary(double x,
double y,
double z)
Creates a new quaternion from the double imaginary components.
|
static Quaterniond |
fromReal(double w)
Creates a new quaternion from the double real component.
|
static Quaterniond |
fromRotationMatrix(Matrix3d matrix)
Creates a new quaternion from the rotation matrix.
|
static Quaterniond |
fromRotationTo(Vector3d from,
Vector3d to)
Creates a new quaternion from the angle-axis rotation defined from the first to the second vector.
|
Vector3d |
getAxesAnglesDeg()
Returns the angles in degrees around the x, y and z axes that correspond to the rotation represented by this quaternion.
|
Vector3d |
getAxesAnglesRad()
Returns the angles in radians around the x, y and z axes that correspond to the rotation represented by this quaternion.
|
Vector3d |
getAxis()
Returns the axis of rotation for this quaternion.
|
Vector3d |
getDirection()
Returns a unit vector representing the direction of this quaternion, which is
Vector3d.FORWARD rotated by this quaternion. |
double |
getW()
Gets the w (real) component of this quaternion.
|
double |
getX()
Gets the x (imaginary) component of this quaternion.
|
double |
getY()
Gets the y (imaginary) component of this quaternion.
|
double |
getZ()
Gets the z (imaginary) component of this quaternion.
|
int |
hashCode() |
Quaterniond |
invert()
Inverts the quaternion.
|
double |
length()
Returns the length of this quaternion.
|
double |
lengthSquared()
Returns the square of the length of this quaternion.
|
Quaterniond |
mul(double a)
Multiplies the components of this quaternion by a double scalar.
|
Quaterniond |
mul(double x,
double y,
double z,
double w)
Multiplies the double components of another quaternion with this one.
|
Quaterniond |
mul(float a)
Multiplies the components of this quaternion by a float scalar.
|
Quaterniond |
mul(float x,
float y,
float z,
float w)
Multiplies the float components of another quaternion with this one.
|
Quaterniond |
mul(Quaterniond q)
Multiplies another quaternion with this one.
|
Quaterniond |
normalize()
Normalizes this quaternion.
|
Vector3d |
rotate(double x,
double y,
double z)
Rotates the double components of a vector by this quaternion.
|
Vector3d |
rotate(float x,
float y,
float z)
Rotates the float components of a vector by this quaternion.
|
Vector3d |
rotate(Vector3d v)
Rotates a vector by this quaternion.
|
Quaterniond |
sub(double x,
double y,
double z,
double w)
Subtracts the double components of another quaternion from this one.
|
Quaterniond |
sub(float x,
float y,
float z,
float w)
Subtracts the float components of another quaternion from this one.
|
Quaterniond |
sub(Quaterniond q)
Subtracts another quaternion from this one.
|
Complexd |
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 Quaterniond ZERO
public static final Quaterniond IDENTITY
public Quaterniond()
public Quaterniond(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 Quaterniond(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 Quaterniond(Quaterniond q)
q - The quaternion to copypublic double getX()
public double getY()
public double getZ()
public double getW()
public Quaterniond add(Quaterniond q)
q - The quaternion to addpublic Quaterniond 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 Quaterniond 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 Quaterniond sub(Quaterniond q)
q - The quaternion to subtractpublic Quaterniond 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 Quaterniond 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 Quaterniond mul(float a)
a - The multiplication scalarpublic Quaterniond mul(double a)
mul in interface Imaginaryda - The multiplication scalarpublic Quaterniond mul(Quaterniond q)
q - The quaternion to multiply withpublic Quaterniond 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 Quaterniond 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 Quaterniond div(float a)
a - The division scalarpublic Quaterniond div(double a)
div in interface Imaginaryda - The division scalarpublic Quaterniond div(Quaterniond q)
q - The quaternion to divide withpublic Quaterniond 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 Quaterniond 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 double dot(Quaterniond q)
q - The quaternion to calculate the dot product withpublic double 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 double 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 Vector3d rotate(Vector3d v)
v - The vector to rotatepublic Vector3d 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 Vector3d 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 Vector3d getDirection()
Vector3d.FORWARD rotated by this quaternion.public Vector3d getAxis()
public Vector3d getAxesAnglesDeg()
public Vector3d getAxesAnglesRad()
public Quaterniond 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 Imaginarydpublic Quaterniond 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 Imaginarydpublic double lengthSquared()
lengthSquared in interface Imaginarydpublic double length()
length in interface Imaginarydpublic Quaterniond normalize()
normalize in interface Imaginarydpublic Complexd toComplex()
public Quaternionf toFloat()
toFloat in interface Imaginarydpublic Quaterniond toDouble()
toDouble in interface Imaginarydpublic int compareTo(Quaterniond q)
compareTo in interface Comparable<Quaterniond>public Quaterniond clone()
public static Quaterniond fromReal(double w)
The ZERO constant is re-used when w is 0.
w - The w (real) componentpublic static Quaterniond fromImaginary(double x, double y, double 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 Quaterniond from(double x, double y, double z, double 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 Quaterniond fromAxesAnglesDeg(float pitch, float yaw, float roll)
pitch - The rotation around xyaw - The rotation around yroll - The rotation around zpublic static Quaterniond fromAxesAnglesRad(float pitch, float yaw, float roll)
pitch - The rotation around xyaw - The rotation around yroll - The rotation around zpublic static Quaterniond fromAxesAnglesDeg(double pitch, double yaw, double roll)
pitch - The rotation around xyaw - The rotation around yroll - The rotation around zpublic static Quaterniond fromAxesAnglesRad(double pitch, double yaw, double roll)
pitch - The rotation around xyaw - The rotation around yroll - The rotation around zpublic static Quaterniond fromRotationTo(Vector3d from, Vector3d to)
from - The first vectorto - The second vectorpublic static Quaterniond fromAngleDegAxis(float angle, Vector3d axis)
angle - The rotation angle in degreesaxis - The axis of rotationpublic static Quaterniond fromAngleRadAxis(float angle, Vector3d axis)
angle - The rotation angle in radiansaxis - The axis of rotationpublic static Quaterniond fromAngleDegAxis(double angle, Vector3d axis)
angle - The rotation angle in degreesaxis - The axis of rotationpublic static Quaterniond fromAngleRadAxis(double angle, Vector3d axis)
angle - The rotation angle in radiansaxis - The axis of rotationpublic static Quaterniond 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 Quaterniond 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 Quaterniond 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 Quaterniond 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 Quaterniond fromRotationMatrix(Matrix3d matrix)
matrix - The rotation matrixCopyright © 2013–2016 Flow Powered. All rights reserved.