AxisAngleBasics
, AxisAngleReadOnly
, Clearable
, EpsilonComparable<AxisAngle>
, GeometricallyComparable<AxisAngle>
, Settable<AxisAngle>
, Orientation3DBasics
, Orientation3DReadOnly
public class AxisAngle extends java.lang.Object implements AxisAngleBasics, EpsilonComparable<AxisAngle>, Settable<AxisAngle>, GeometricallyComparable<AxisAngle>
AxisAngle
is used to represent a 3D orientation by a unitary axis of components (x, y,
z) and an angle of rotation usually expressed in radians.
This version of axis-angle uses double precision fields to save the value of each component. It is meant for garbage free usage.
ORIENTATION_2D_EPSILON
Constructor | Description |
---|---|
AxisAngle() |
Creates an axis-angle that represents a "zero" rotation.
|
AxisAngle(double[] axisAngleArray) |
Creates an axis-angle initialized with the values contained in the given array:
this.setX(axisAngleArray[0]);
this.setY(axisAngleArray[1]);
this.setZ(axisAngleArray[2]);
this.setAngle(axisAngleArray[3]);
|
AxisAngle(double yaw,
double pitch,
double roll) |
Creates an axis-angle such that it represents the same orientation the yaw-pitch-roll angles
represents.
|
AxisAngle(double x,
double y,
double z,
double angle) |
Creates an axis-angle with the given values of the axis (
x , y , z ) and
of the angle angle . |
AxisAngle(Orientation3DReadOnly orientation) |
Creates an axis-angle that represents the same orientation as the given one.
|
AxisAngle(Vector3DReadOnly rotationVector) |
Creates an axis-angle such that it represents the same orientation the rotation vector
represents.
|
AxisAngle(Vector3DReadOnly axis,
double angle) |
Create an axis-angle from the given axis and angle.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
epsilonEquals(AxisAngle other,
double epsilon) |
Tests on a per component basis, if this axis-angle is equal to
other to an
epsilon . |
boolean |
equals(java.lang.Object object) |
Tests if the given
object 's class is the same as this, in which case the method
returns AxisAngleReadOnly.equals(AxisAngleReadOnly) , it returns false otherwise. |
boolean |
geometricallyEquals(AxisAngle other,
double epsilon) |
Tests if
this and other represent the same orientation to an epsilon . |
double |
getAngle() |
Returns the angle of this axis-angle, usually expressed in radians.
|
double |
getX() |
Returns the x-component of the unitary axis of this axis-angle.
|
double |
getY() |
Returns the y-component of the unitary axis of this axis-angle.
|
double |
getZ() |
Returns the z-component of the unitary axis of this axis-angle.
|
int |
hashCode() |
Calculates and returns a hash code value from the value of each component of this axis-angle.
|
void |
set(AxisAngle other) |
Sets this axis-angle to the same value as the given axis-angle
other . |
void |
setAngle(double angle) |
Sets a new angle to this axis-angle.
|
void |
setX(double x) |
Sets a new x-component for the axis of this axis-angle.
|
void |
setY(double y) |
Sets a new y-component for the axis of this axis-angle.
|
void |
setZ(double z) |
Sets a new z-component for the axis of this axis-angle.
|
java.lang.String |
toString() |
Provides a
String representation of this axis-angle as follows: (x, y, z, angle). |
absolute, append, appendInvertOther, appendPitchRotation, appendRollRotation, appendYawRotation, containsNaN, inverse, invert, multiply, multiply, multiplyInvertBoth, multiplyInvertOther, multiplyInvertThis, negate, normalize, normalizeAxis, preMultiply, preMultiplyInvertBoth, preMultiplyInvertOther, preMultiplyInvertThis, prepend, prependInvertOther, prependPitchRotation, prependRollRotation, prependYawRotation, scaleAngle, set, set, set, set, set, set, set, set, setAndNegate, setAxisAngle, setElement, setQuaternion, setRotationMatrix, setRotationVector, setToNaN, setToZero, setYawPitchRoll
addTransform, axisNorm, checkIfIsZOnly, distance, epsilonEquals, equals, geometricallyEquals, get, get, get, get, get, get, get, getAngle32, getElement, getElement32, getEuler, getPitch, getRoll, getRotationVector, getX32, getY32, getYaw, getYawPitchRoll, getZ32, inverseTransform, inverseTransform, inverseTransform, inverseTransform, isAxisUnitary, isOrientation2D, isZOnly, transform, transform, transform, transform
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
appendInvertBoth, appendInvertThis, prependInvertBoth, prependInvertThis, setAndInvert, setAndNormalize, setEuler, setEuler, setRotationVector, setYawPitchRoll
addTransform, checkIfOrientation2D, checkIfOrientation2D, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, isOrientation2D, toStringAsYawPitchRoll, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform
public AxisAngle()
public AxisAngle(Orientation3DReadOnly orientation)
orientation
- the orientation to initialize this axis-angle. Not modified.public AxisAngle(double x, double y, double z, double angle)
x
, y
, z
) and
of the angle angle
.x
- x-component of the axis.y
- y-component of the axis.z
- z-component of the axis.angle
- the angle value.public AxisAngle(double[] axisAngleArray)
this.setX(axisAngleArray[0]);
this.setY(axisAngleArray[1]);
this.setZ(axisAngleArray[2]);
this.setAngle(axisAngleArray[3]);
axisAngleArray
- the array containing the values for this axis-angle. Not modified.public AxisAngle(Vector3DReadOnly axis, double angle)
axis
- the axis. Not modifiedangle
- the angle value.public AxisAngle(Vector3DReadOnly rotationVector)
AxisAngleConversion.convertRotationVectorToAxisAngle(Vector3DReadOnly, AxisAngleBasics)
.
WARNING: a rotation vector is different from a yaw-pitch-roll or Euler angles representation. A rotation vector is equivalent to the axis of an axis-angle that is multiplied by the angle of the same axis-angle.
rotationVector
- the rotation vector used to create this axis-angle. Not modified.public AxisAngle(double yaw, double pitch, double roll)
AxisAngleConversion.convertYawPitchRollToAxisAngle(double, double, double, AxisAngleBasics)
.yaw
- the angle to rotate about the z-axis.pitch
- the angle to rotate about the y-axis.roll
- the angle to rotate about the x-axis.public void set(AxisAngle other)
other
.public final void setX(double x)
setX
in interface AxisAngleBasics
x
- the new axis x-component.public final void setY(double y)
setY
in interface AxisAngleBasics
y
- the new axis y-component.public final void setZ(double z)
setZ
in interface AxisAngleBasics
z
- the new axis z-component.public final void setAngle(double angle)
setAngle
in interface AxisAngleBasics
angle
- the new angle.public double getX()
getX
in interface AxisAngleReadOnly
public double getY()
getY
in interface AxisAngleReadOnly
public double getZ()
getZ
in interface AxisAngleReadOnly
public final double getAngle()
getAngle
in interface AxisAngleReadOnly
public boolean equals(java.lang.Object object)
object
's class is the same as this, in which case the method
returns AxisAngleReadOnly.equals(AxisAngleReadOnly)
, it returns false
otherwise.equals
in class java.lang.Object
object
- the object to compare against this. Not modified.true
if object
and this are exactly equal, false
otherwise.public boolean epsilonEquals(AxisAngle other, double epsilon)
other
to an
epsilon
. A failing test does not necessarily mean that the two axis-angles represent
two different orientations.epsilonEquals
in interface EpsilonComparable<AxisAngle>
other
- the other axis-angle to compare against this. Not modified.epsilon
- tolerance to use when comparing each component.true
if the two axis-angle are equal component-wise, false
otherwise.public boolean geometricallyEquals(AxisAngle other, double epsilon)
this
and other
represent the same orientation to an epsilon
.
Two axis-angle are considered geometrically equal if the magnitude of their difference is less
than or equal to epsilon
.
Note that this.geometricallyEquals(other, epsilon) == true
does not necessarily imply
this.epsilonEquals(other, epsilon)
and vice versa.
geometricallyEquals
in interface GeometricallyComparable<AxisAngle>
other
- the other axis-angle to compare against this. Not modified.epsilon
- the maximum angle for the two quaternions to be considered equal.true
if the two axis-angle represent the same geometry, false
otherwise.public java.lang.String toString()
String
representation of this axis-angle as follows: (x, y, z, angle).toString
in class java.lang.Object
String
representing this axis-angle.public int hashCode()
hashCode
in class java.lang.Object