public class Quaternion extends Object implements IQuaternion, Serializable
Modifier and Type | Field and Description |
---|---|
static IQuaternion |
IDENTITY
The identity quaternion.
|
double |
w
The components of the quaternion.
|
double |
x
The components of the quaternion.
|
double |
y
The components of the quaternion.
|
double |
z
The components of the quaternion.
|
Constructor and Description |
---|
Quaternion()
Creates an identity quaternion.
|
Quaternion(double[] values)
Creates a quaternion from an array of values.
|
Quaternion(double x,
double y,
double z,
double w)
Creates a quaternion from four components.
|
Quaternion(IQuaternion other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
Quaternion |
fromAngleAxis(double angle,
double x,
double y,
double z)
Sets this quaternion to the rotation described by the given angle and normalized
axis.
|
Quaternion |
fromAngleAxis(double angle,
IVector3 axis)
Sets this quaternion to the rotation described by the given angle and normalized
axis.
|
Quaternion |
fromAngles(double x,
double y,
double z)
Sets this quaternion to one that first rotates about x by the specified number of radians,
then rotates about y, then about z.
|
Quaternion |
fromAngles(Vector3 angles)
Sets this quaternion to one that first rotates about x by the specified number of radians,
then rotates about y, then about z.
|
Quaternion |
fromAnglesXY(double x,
double y)
Sets this quaternion to one that first rotates about x by the specified number of radians,
then rotates about y by the specified number of radians.
|
Quaternion |
fromAnglesXZ(double x,
double z)
Sets this quaternion to one that first rotates about x by the specified number of radians,
then rotates about z by the specified number of radians.
|
Quaternion |
fromAxes(IVector3 nx,
IVector3 ny,
IVector3 nz)
Sets this quaternion to one that rotates onto the given unit axes.
|
Quaternion |
fromVectorFromNegativeZ(double tx,
double ty,
double tz)
Sets this quaternion to the rotation of (0, 0, -1) onto the supplied normalized vector.
|
Quaternion |
fromVectorFromNegativeZ(IVector3 to)
Sets this quaternion to the rotation of (0, 0, -1) onto the supplied normalized vector.
|
Quaternion |
fromVectors(IVector3 from,
IVector3 to)
Sets this quaternion to the rotation of the first normalized vector onto the second.
|
void |
get(double[] values)
Populates the supplied array with the contents of this quaternion.
|
double |
getRotationZ()
Returns the amount of rotation about the z axis (for the purpose of flattening the
rotation).
|
int |
hashCode() |
boolean |
hasNaN()
Checks whether any of the components of this quaternion are not-numbers.
|
Quaternion |
integrate(IVector3 velocity,
double t)
Integrates the provided angular velocity over the specified timestep.
|
Quaternion |
integrate(IVector3 velocity,
double t,
Quaternion result)
Integrates the provided angular velocity over the specified timestep, storing the result in
the object provided.
|
Quaternion |
integrateLocal(IVector3 velocity,
double t)
Integrates in-place the provided angular velocity over the specified timestep.
|
Quaternion |
invert()
Inverts this quaternion.
|
Quaternion |
invert(Quaternion result)
Inverts this quaternion, storing the result in the object provided.
|
Quaternion |
invertLocal()
Inverts this quaternion in-place.
|
Quaternion |
mult(IQuaternion other)
Multiplies this quaternion by another.
|
Quaternion |
mult(IQuaternion other,
Quaternion result)
Multiplies this quaternion by another and stores the result in the provided object.
|
Quaternion |
multLocal(IQuaternion other)
Multiplies this quaternion in-place by another.
|
Quaternion |
normalize()
Normalizes this quaternion.
|
Quaternion |
normalize(Quaternion result)
Normalizes this quaternion, storing the result in the object provided.
|
Quaternion |
normalizeLocal()
Normalizes this quaternion in-place.
|
Quaternion |
randomize(Random rand)
Sets this to a random rotation obtained from a completely uniform distribution.
|
Quaternion |
set(double[] values)
Copies the elements of an array.
|
Quaternion |
set(double x,
double y,
double z,
double w)
Sets all of the elements of the quaternion.
|
Quaternion |
set(IQuaternion other)
Copies the elements of another quaternion.
|
Quaternion |
slerp(IQuaternion other,
double t)
Interpolates between this and the specified other quaternion.
|
Quaternion |
slerp(IQuaternion other,
double t,
Quaternion result)
Interpolates between this and the specified other quaternion, placing the result in the
object provided.
|
Quaternion |
slerpLocal(IQuaternion other,
double t)
Interpolates in-place between this and the specified other quaternion.
|
Vector3 |
toAngles()
Computes and returns the angles to pass to
fromAngles(pythagoras.d.Vector3) to reproduce this
rotation. |
Vector3 |
toAngles(Vector3 result)
Computes the angles to pass to
fromAngles(pythagoras.d.Vector3) to reproduce this rotation,
placing them in the provided vector. |
String |
toString() |
Vector3 |
transform(IVector3 vector)
Transforms a vector by this quaternion.
|
Vector3 |
transform(IVector3 vector,
Vector3 result)
Transforms a vector by this quaternion and places the result in the provided object.
|
Vector3 |
transformAndAdd(IVector3 vector,
IVector3 add,
Vector3 result)
Transforms a vector by this quaternion and adds another vector to it, placing the result
in the object provided.
|
Vector3 |
transformLocal(Vector3 vector)
Transforms a vector in-place by this quaternion.
|
Vector3 |
transformScaleAndAdd(IVector3 vector,
double scale,
IVector3 add,
Vector3 result)
Transforms a vector by this quaternion, applies a uniform scale, and adds another vector to
it, placing the result in the object provided.
|
Vector3 |
transformUnitX(Vector3 result)
Transforms the unit x vector by this quaternion, placing the result in the provided object.
|
Vector3 |
transformUnitY(Vector3 result)
Transforms the unit y vector by this quaternion, placing the result in the provided object.
|
Vector3 |
transformUnitZ(Vector3 result)
Transforms the unit z vector by this quaternion, placing the result in the provided object.
|
double |
transformZ(IVector3 vector)
Transforms a vector by this quaternion and returns the z coordinate of the result.
|
double |
w()
Returns the w-component of this quaternion.
|
double |
x()
Returns the x-component of this quaternion.
|
double |
y()
Returns the y-component of this quaternion.
|
double |
z()
Returns the z-component of this quaternion.
|
public static final IQuaternion IDENTITY
public double x
public double y
public double z
public double w
public Quaternion(double x, double y, double z, double w)
public Quaternion(double[] values)
public Quaternion(IQuaternion other)
public Quaternion()
public Quaternion set(IQuaternion other)
public Quaternion set(double[] values)
public Quaternion set(double x, double y, double z, double w)
public Quaternion fromVectors(IVector3 from, IVector3 to)
public Quaternion fromVectorFromNegativeZ(IVector3 to)
public Quaternion fromVectorFromNegativeZ(double tx, double ty, double tz)
public Quaternion fromAxes(IVector3 nx, IVector3 ny, IVector3 nz)
public Quaternion fromAngleAxis(double angle, IVector3 axis)
public Quaternion fromAngleAxis(double angle, double x, double y, double z)
public Quaternion randomize(Random rand)
public Quaternion fromAnglesXZ(double x, double z)
public Quaternion fromAnglesXY(double x, double y)
public Quaternion fromAngles(Vector3 angles)
public Quaternion fromAngles(double x, double y, double z)
public Quaternion normalizeLocal()
public Quaternion invertLocal()
public Quaternion multLocal(IQuaternion other)
public Quaternion slerpLocal(IQuaternion other, double t)
public Vector3 transformLocal(Vector3 vector)
public Quaternion integrateLocal(IVector3 velocity, double t)
public double x()
IQuaternion
x
in interface IQuaternion
public double y()
IQuaternion
y
in interface IQuaternion
public double z()
IQuaternion
z
in interface IQuaternion
public double w()
IQuaternion
w
in interface IQuaternion
public void get(double[] values)
IQuaternion
get
in interface IQuaternion
public boolean hasNaN()
IQuaternion
hasNaN
in interface IQuaternion
public Vector3 toAngles(Vector3 result)
IQuaternion
fromAngles(pythagoras.d.Vector3)
to reproduce this rotation,
placing them in the provided vector. This uses the factorization method described in David
Eberly's Euler Angle
Formulas.toAngles
in interface IQuaternion
public Vector3 toAngles()
IQuaternion
fromAngles(pythagoras.d.Vector3)
to reproduce this
rotation.toAngles
in interface IQuaternion
public Quaternion normalize()
IQuaternion
normalize
in interface IQuaternion
public Quaternion normalize(Quaternion result)
IQuaternion
normalize
in interface IQuaternion
public Quaternion invert()
IQuaternion
invert
in interface IQuaternion
public Quaternion invert(Quaternion result)
IQuaternion
invert
in interface IQuaternion
public Quaternion mult(IQuaternion other)
IQuaternion
mult
in interface IQuaternion
public Quaternion mult(IQuaternion other, Quaternion result)
IQuaternion
mult
in interface IQuaternion
public Quaternion slerp(IQuaternion other, double t)
IQuaternion
slerp
in interface IQuaternion
public Quaternion slerp(IQuaternion other, double t, Quaternion result)
IQuaternion
slerp
in interface IQuaternion
public Vector3 transform(IVector3 vector)
IQuaternion
transform
in interface IQuaternion
public Vector3 transform(IVector3 vector, Vector3 result)
IQuaternion
transform
in interface IQuaternion
public Vector3 transformUnitX(Vector3 result)
IQuaternion
transformUnitX
in interface IQuaternion
public Vector3 transformUnitY(Vector3 result)
IQuaternion
transformUnitY
in interface IQuaternion
public Vector3 transformUnitZ(Vector3 result)
IQuaternion
transformUnitZ
in interface IQuaternion
public Vector3 transformAndAdd(IVector3 vector, IVector3 add, Vector3 result)
IQuaternion
transformAndAdd
in interface IQuaternion
public Vector3 transformScaleAndAdd(IVector3 vector, double scale, IVector3 add, Vector3 result)
IQuaternion
transformScaleAndAdd
in interface IQuaternion
public double transformZ(IVector3 vector)
IQuaternion
transformZ
in interface IQuaternion
public double getRotationZ()
IQuaternion
getRotationZ
in interface IQuaternion
public Quaternion integrate(IVector3 velocity, double t)
IQuaternion
integrate
in interface IQuaternion
public Quaternion integrate(IVector3 velocity, double t, Quaternion result)
IQuaternion
integrate
in interface IQuaternion
Copyright © 2017. All rights reserved.