Top Description Fields Constructors Methods
org.apache.commons.math3.geometry.euclidean.threed

public Class FieldRotation<T extends RealFieldElement<T>>

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Type Parameters
<T>
the type of the field elements
Imports
java.io.Serializable, org.apache.commons.math3.RealFieldElement, .Field, org.apache.commons.math3.exception.MathArithmeticException, .MathIllegalArgumentException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.util.FastMath, .MathArrays

This class is a re-implementation of Rotation using RealFieldElement.

Instance of this class are guaranteed to be immutable.

Since
3.2
See Also
FieldVector3D, RotationOrder

Field Summary

Modifier and TypeField and Description
private final T
q0

Scalar coordinate of the quaternion.

private final T
q1

First coordinate of the vectorial part of the quaternion.

private final T
q2

Second coordinate of the vectorial part of the quaternion.

private final T
q3

Third coordinate of the vectorial part of the quaternion.

private static final long
serialVersionUID

Serializable version identifier

Constructor Summary

AccessConstructor and Description
public
FieldRotation(final T
scalar part of the quaternion
q0
,
final T
first coordinate of the vectorial part of the quaternion
q1
,
final T
second coordinate of the vectorial part of the quaternion
q2
,
final T
third coordinate of the vectorial part of the quaternion
q3
,
final boolean
if true, the coordinates are considered not to be normalized, a normalization preprocessing step is performed before using them
needsNormalization
)

Build a rotation from the quaternion coordinates.

public
FieldRotation(final FieldVector3D<T>
axis around which to rotate
axis
,
final T
rotation angle.
angle
)

Build a rotation from an axis and an angle.

public
FieldRotation(final FieldVector3D<T>
axis around which to rotate
axis
,
final T
rotation angle.
angle
,
final RotationConvention
convention to use for the semantics of the angle
convention
)

Build a rotation from an axis and an angle.

public
FieldRotation(final T[][]
rotation matrix
m
,
final double
convergence threshold for the iterative orthogonality correction (convergence is reached when the difference between two steps of the Frobenius norm of the correction is below this threshold)
threshold
)

Build a rotation from a 3X3 matrix.

public
FieldRotation(FieldVector3D<T>
first vector of the origin pair
u1
,
FieldVector3D<T>
second vector of the origin pair
u2
,
FieldVector3D<T>
desired image of u1 by the rotation
v1
,
FieldVector3D<T>
desired image of u2 by the rotation
v2
)

Build the rotation that transforms a pair of vectors into another pair.

public
FieldRotation(final FieldVector3D<T>
origin vector
u
,
final FieldVector3D<T>
desired image of u by the rotation
v
)

Build one of the rotations that transform one vector into another one.

public
FieldRotation(final RotationOrder
order of rotations to use
order
,
final T
angle of the first elementary rotation
alpha1
,
final T
angle of the second elementary rotation
alpha2
,
final T
angle of the third elementary rotation
alpha3
)

Build a rotation from three Cardan or Euler elementary rotations.

public
FieldRotation(final RotationOrder
order of rotations to compose, from left to right (i.e. we will use r1.compose(r2.compose(r3, convention), convention))
order
,
final RotationConvention
convention to use for the semantics of the angle
convention
,
final T
angle of the first elementary rotation
alpha1
,
final T
angle of the second elementary rotation
alpha2
,
final T
angle of the third elementary rotation
alpha3
)

Build a rotation from three Cardan or Euler elementary rotations.

Method Summary

Modifier and TypeMethod and Description
public FieldVector3D<T>

Returns:

a new vector which such that u is its image by the rotation
applyInverseTo
(final FieldVector3D<T>
vector to apply the inverse of the rotation to
u
)

Apply the inverse of the rotation to a vector.

public FieldVector3D<T>

Returns:

a new vector which such that u is its image by the rotation
applyInverseTo
(final Vector3D
vector to apply the inverse of the rotation to
u
)

Apply the inverse of the rotation to a vector.

public void
applyInverseTo(final T[]
an array with three items which stores vector to rotate
in
,
final T[]
an array with three items to put result to (it can be the same array as in)
out
)

Apply the inverse of the rotation to a vector stored in an array.

public void
applyInverseTo(final double[]
an array with three items which stores vector to rotate
in
,
final T[]
an array with three items to put result to
out
)

Apply the inverse of the rotation to a vector stored in an array.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
FieldVector3D<T>

Returns:

a new vector which such that u is its image by the rotation
applyInverseTo
(final Rotation
rotation to apply
r
,
final FieldVector3D<T>
vector to apply the inverse of the rotation to
u
)

Apply the inverse of a rotation to a vector.

public FieldRotation<T>

Returns:

a new rotation which is the composition of r by the inverse of the instance
applyInverseTo
(final FieldRotation<T>
rotation to apply the rotation to
r
)

Apply the inverse of the instance to another rotation.

public FieldRotation<T>

Returns:

a new rotation which is the composition of r by the inverse of the instance
applyInverseTo
(final Rotation
rotation to apply the rotation to
r
)

Apply the inverse of the instance to another rotation.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
FieldRotation<T>

Returns:

a new rotation which is the composition of r by the inverse of the instance
applyInverseTo
(final Rotation
rotation to apply the rotation to
rOuter
,
final FieldRotation<T>
rotation to apply the rotation to
rInner
)

Apply the inverse of a rotation to another rotation.

public FieldVector3D<T>

Returns:

a new vector which is the image of u by the rotation
applyTo
(final FieldVector3D<T>
vector to apply the rotation to
u
)

Apply the rotation to a vector.

public FieldVector3D<T>

Returns:

a new vector which is the image of u by the rotation
applyTo
(final Vector3D
vector to apply the rotation to
u
)

Apply the rotation to a vector.

public void
applyTo(final T[]
an array with three items which stores vector to rotate
in
,
final T[]
an array with three items to put result to (it can be the same array as in)
out
)

Apply the rotation to a vector stored in an array.

public void
applyTo(final double[]
an array with three items which stores vector to rotate
in
,
final T[]
an array with three items to put result to
out
)

Apply the rotation to a vector stored in an array.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
FieldVector3D<T>

Returns:

a new vector which is the image of u by the rotation
applyTo
(final Rotation
rotation to apply
r
,
final FieldVector3D<T>
vector to apply the rotation to
u
)

Apply a rotation to a vector.

public FieldRotation<T>

Returns:

a new rotation which is the composition of r by the instance
applyTo
(final FieldRotation<T>
rotation to apply the rotation to
r
)

Apply the instance to another rotation.

public FieldRotation<T>

Returns:

a new rotation which is the composition of r by the instance
applyTo
(final Rotation
rotation to apply the rotation to
r
)

Apply the instance to another rotation.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
FieldRotation<T>

Returns:

a new rotation which is the composition of r by the instance
applyTo
(final Rotation
rotation to apply
r1
,
final FieldRotation<T>
rotation to apply the rotation to
rInner
)

Apply a rotation to another rotation.

private T[]

Returns:

new array
buildArray
(final T
first array element
a0
,
final T
second array element
a1
,
final T
third array element
a2
)

Create a dimension 3 array.

public FieldRotation<T>

Returns:

a new rotation which is the composition of r by the instance
compose
(final FieldRotation<T>
rotation to apply the rotation to
r
,
final RotationConvention
convention to use for the semantics of the angle
convention
)

Compose the instance with another rotation.

public FieldRotation<T>

Returns:

a new rotation which is the composition of r by the instance
compose
(final Rotation
rotation to apply the rotation to
r
,
final RotationConvention
convention to use for the semantics of the angle
convention
)

Compose the instance with another rotation.

private FieldRotation<T>

Returns:

a new rotation which is the composition of r by the instance using vector operator convention
composeInternal
(final FieldRotation<T>
rotation to apply the rotation to
r
)

Compose the instance with another rotation using vector operator convention.

private FieldRotation<T>

Returns:

a new rotation which is the composition of r by the instance using vector operator convention
composeInternal
(final Rotation
rotation to apply the rotation to
r
)

Compose the instance with another rotation using vector operator convention.

public FieldRotation<T>

Returns:

a new rotation which is the composition of r by the inverse of the instance
composeInverse
(final FieldRotation<T>
rotation to apply the rotation to
r
,
final RotationConvention
convention to use for the semantics of the angle
convention
)

Compose the inverse of the instance with another rotation.

public FieldRotation<T>

Returns:

a new rotation which is the composition of r by the inverse of the instance
composeInverse
(final Rotation
rotation to apply the rotation to
r
,
final RotationConvention
convention to use for the semantics of the angle
convention
)

Compose the inverse of the instance with another rotation.

private FieldRotation<T>

Returns:

a new rotation which is the composition of r by the inverse of the instance using vector operator convention
composeInverseInternal
(FieldRotation<T>
rotation to apply the rotation to
r
)

Compose the inverse of the instance with another rotation using vector operator convention.

private FieldRotation<T>

Returns:

a new rotation which is the composition of r by the inverse of the instance using vector operator convention
composeInverseInternal
(Rotation
rotation to apply the rotation to
r
)

Compose the inverse of the instance with another rotation using vector operator convention.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

distance between r1 and r2
distance
(final FieldRotation<T>
first rotation
r1
,
final FieldRotation<T>
second rotation
r2
)

Compute the distance between two rotations.

public T

Returns:

angle of the rotation (between 0 and π)
getAngle
()

Get the angle of the rotation.

public T[]

Returns:

an array of three angles, in the order specified by the set
getAngles
(final RotationOrder
rotation order to use
order
)
Deprecated as of 3.6, replaced with getAngles(RotationOrder, RotationConvention)

Get the Cardan or Euler angles corresponding to the instance.

public T[]

Returns:

an array of three angles, in the order specified by the set
getAngles
(final RotationOrder
rotation order to use
order
,
RotationConvention
convention to use for the semantics of the angle
convention
)

Get the Cardan or Euler angles corresponding to the instance.

public FieldVector3D<T>

Returns:

normalized axis of the rotation
getAxis
()
Deprecated as of 3.6, replaced with getAxis(RotationConvention)

Get the normalized axis of the rotation.

public FieldVector3D<T>

Returns:

normalized axis of the rotation
getAxis
(final RotationConvention
convention to use for the semantics of the angle
convention
)

Get the normalized axis of the rotation.

public T[][]

Returns:

the matrix corresponding to the instance
getMatrix
()

Get the 3X3 matrix corresponding to the instance

public T

Returns:

scalar coordinate of the quaternion
getQ0
()

Get the scalar coordinate of the quaternion.

public T

Returns:

first coordinate of the vectorial part of the quaternion
getQ1
()

Get the first coordinate of the vectorial part of the quaternion.

public T

Returns:

second coordinate of the vectorial part of the quaternion
getQ2
()

Get the second coordinate of the vectorial part of the quaternion.

public T

Returns:

third coordinate of the vectorial part of the quaternion
getQ3
()

Get the third coordinate of the vectorial part of the quaternion.

private T[]

Returns:

quaternion corresponding to the matrix
mat2quat
(final T[][]
orthogonal rotation matrix
ort
)

Convert an orthogonal rotation matrix to a quaternion.

private T[][]

Returns:

an orthogonal matrix close to m
orthogonalizeMatrix
(final T[][]
initial matrix (not exactly orthogonal)
m
,
final double
convergence threshold for the iterative orthogonality correction (convergence is reached when the difference between two steps of the Frobenius norm of the correction is below this threshold)
threshold
)

Perfect orthogonality on a 3X3 matrix.

public FieldRotation<T>

Returns:

a new rotation whose effect is the reverse of the effect of the instance
revert
()

Revert a rotation.

public Rotation

Returns:

a constant vector
toRotation
()

Convert to a constant vector without derivatives.

private FieldVector3D<T>

Returns:

a constant vector
vector
(final double
abscissa
x
,
final double
ordinate
y
,
final double
height
z
)

Create a constant vector.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait