Rotations can be represented by several different mathematical entities (matrices, axe and angle, Cardan or Euler angles, quaternions). This class presents an higher level abstraction, more user-oriented and hiding this implementation details. Well, for the curious, we use quaternions for the internal representation. The user can build a rotation from any of these representations, and any of these representations can be retrieved from a Rotation
instance (see the various constructors and getters). In addition, a rotation can also be built implicitly from a set of vectors and their image.
This implies that this class can be used to convert from one representation to another one. For example, converting a rotation matrix into a set of Cardan angles from can be done using the following single line of code:
double[] angles = new Rotation(matrix, 1.0e-10).getAngles(RotationOrder.XYZ);
Focus is oriented on what a rotation do rather than on its underlying representation. Once it has been built, and regardless of its internal representation, a rotation is an operator which basically transforms three dimensional {@link Vector3D vectors} into other threedimensional {@link Vector3D vectors}. Depending on the application, the meaning of these vectors may vary and the semantics of the rotation also.
For example in an spacecraft attitude simulation tool, users will often consider the vectors are fixed (say the Earth direction for example) and the frames change. The rotation transforms the coordinates of the vector in inertial frame into the coordinates of the same vector in satellite frame. In this case, the rotation implicitly defines the relation between the two frames.
Another example could be a telescope control application, where the rotation would transform the sighting direction at rest into the desired observing direction when the telescope is pointed towards an object of interest. In this case the rotation transforms the direction at rest in a topocentric frame into the sighting direction in the same topocentric frame. This implies in this case the frame is fixed and the vector moves.
In many case, both approaches will be combined. In our telescope example, we will probably also need to transform the observing direction in the topocentric frame into the observing direction in inertial frame taking into account the observatory location and the Earth rotation, which would essentially be an application of the first approach.
These examples show that a rotation is what the user wants it to be. This class does not push the user towards one specific definition and hence does not provide methods like projectVectorIntoDestinationFrame
or computeTransformedDirection
. It provides simpler and more generic methods: {@link #applyTo(Vector3D) applyTo(Vector3D)} and {@link #applyInverseTo(Vector3D) applyInverseTo(Vector3D)}.
Since a rotation is basically a vectorial operator, several rotations can be composed together and the composite operation r = r1 o r2
(which means that for each vector u
, r(u) = r1(r2(u))
) is also a rotation. Hence we can consider that in addition to vectors, a rotation can be applied to other rotations as well (or to itself). With our previous notations, we would say we can apply r1
to r2
and the result we get is r = r1 o r2
. For this purpose, the class provides the methods: {@link #applyTo(Rotation) applyTo(Rotation)} and{@link #applyInverseTo(Rotation) applyInverseTo(Rotation)}.
Rotations are guaranteed to be immutable objects.
@see Vector3D @see RotationOrder @since 1.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|