public class Transform extends Object implements TimeStamped, TimeShiftable<Transform>, TimeInterpolable<Transform>, Serializable
This class represents the transformation engine between frames
. It is
used both to define the relationship between each frame and its parent frame and to gather all individual transforms
into one operation when converting between frames far away from each other.
A Transform object contain the position, velocity and orientation vectors that describe the "destination"
frames
in the "origin" one. This means that, defining X_ref=(1,0,0) in
the origin frame, the vector X_destination (X axis of the destination frame, still expressed in the reference frame)
is obtained by : rotation.applyTo(X_ref).
Instances of this class are guaranteed to be immutable.
1 ) Example of translation from RA to RB: We want to transform thePVCoordinates
PVA to PVB. With : PVA = ({1, 0, 0} , {1, 0, 0} , {1, 0, 0}); and : PVB = ({0, 0, 0} , {0, 0, 0} , {0, 0, 0}); The transform to apply then is defined as follows : Vector3D translation = new Vector3D(1,0,0); Vector3D velocity = new Vector3D(1,0,0); Vector3D acc = new Vector3D(1,0,0); Transform R1toR2 = new Transform(date, translation, Velocity, acc); PVB = R1toR2.transformPVCoordinates(PVA); 2 ) Example of rotation from RA to RB: We want to transform thePVCoordinates
PVA to PVB. With : PVA = ({0, 1, 0}, {-2, 1, 0}); and : PVB = ({1, 0, 0}, {1, 0, 0}); The transform to apply then is defined as follows : Rotation rotation = new Rotation(Vector3D.PLUS_K, FastMath.PI / 2); Vector3D rotationRate = new Vector3D(0, 0, 2); Transform R1toR2 = new Transform(date, rotation, rotationRate); PVB = R1toR2.transformPVCoordinates(PVA);
Modifier and Type | Field and Description |
---|---|
static Transform |
IDENTITY
Identity transform.
|
Constructor and Description |
---|
Transform(AbsoluteDate dateIn,
AngularCoordinates angularIn)
Build a rotation transform.
|
Transform(AbsoluteDate dateIn,
PVCoordinates cartesianIn)
Build a translation transform, with its first time derivative.
|
Transform(AbsoluteDate dateIn,
PVCoordinates cartesianIn,
AngularCoordinates angularIn)
Build a transform from its primitive operations.
|
Transform(AbsoluteDate dateIn,
Rotation rotation)
Build a rotation transform.
|
Transform(AbsoluteDate dateIn,
Rotation rotation,
Vector3D rotationRate)
Build a rotation transform.
|
Transform(AbsoluteDate dateIn,
Rotation rotation,
Vector3D rotationRate,
Vector3D rotationAcceleration)
Build a rotation transform.
|
Transform(AbsoluteDate dateIn,
Transform first,
Transform second)
Build a transform by combining two existing ones without computing spin derivatives.
|
Transform(AbsoluteDate dateIn,
Transform first,
Transform second,
boolean computeSpinDerivatives)
Build a transform by combining two existing ones.
|
Transform(AbsoluteDate dateIn,
Vector3D translation)
Build a translation transform.
|
Transform(AbsoluteDate dateIn,
Vector3D translation,
Vector3D velocity)
Build a translation transform, with its first time derivative.
|
Transform(AbsoluteDate dateIn,
Vector3D translation,
Vector3D velocity,
Vector3D acceleration)
Build a translation transform, with its first and second time derivatives.
|
Modifier and Type | Method and Description |
---|---|
Transform |
freeze()
Get a freezed transform.
|
Vector3D |
getAcceleration()
Get the second time derivative of the translation.
|
AngularCoordinates |
getAngular()
Get the orientation and rotation rate of the "destination" frame in the "origin" one.
|
PVCoordinates |
getCartesian()
Get the position and velocity of the "destination" frame in the "origin" one.
|
AbsoluteDate |
getDate()
Get the date.
|
Transform |
getInverse()
Get the inverse transform of the instance.
|
Transform |
getInverse(boolean computeSpinDerivatives)
Get the inverse transform of the instance.
|
void |
getJacobian(double[][] jacobian)
Compute the Jacobian of the
transformPVCoordinates(PVCoordinates) method of the transform. |
Rotation |
getRotation()
Get the orientation of the "destination" frame in the "origin" one.
|
Vector3D |
getRotationAcceleration()
Get the second time derivative of the rotation.
|
Vector3D |
getRotationRate()
Get the rotation rate of the "destination" frame in the "origin" one.
|
Vector3D |
getTranslation()
Get the position of the "destination" frame in the "origin" one.
|
Vector3D |
getVelocity()
Get the velocity of the "destination" frame in the "origin" one.
|
static Transform |
interpolate(AbsoluteDate date,
boolean useVelocities,
boolean useRotationRates,
Collection<Transform> sample)
Interpolate a transform from a sample set of existing transforms.
|
static Transform |
interpolate(AbsoluteDate date,
boolean useVelocities,
boolean useRotationRates,
Collection<Transform> sample,
boolean computeSpinDerivative)
Interpolate a transform from a sample set of existing transforms.
|
Transform |
interpolate(AbsoluteDate interpolationDate,
Collection<Transform> sample)
Get an interpolated instance.
|
Transform |
interpolate(AbsoluteDate interpolationDate,
Collection<Transform> sample,
boolean computeSpinDerivative)
Get an interpolated instance.
|
Transform |
shiftedBy(double dt)
Get a time-shifted instance.
|
Transform |
shiftedBy(double dt,
boolean computeSpinDerivative)
Get a time-shifted instance.
|
Line |
transformLine(Line line)
Transform a line from an algebraic point of view.
|
Vector3D |
transformPosition(Vector3D position)
Transform a position vector (including translation effects).
|
PVCoordinates |
transformPVCoordinates(PVCoordinates pv)
Transform
PVCoordinates including kinematic effects from an algebraic point of view. |
TimeStampedPVCoordinates |
transformPVCoordinates(TimeStampedPVCoordinates pv)
Transform
TimeStampedPVCoordinates including kinematic effects. |
Vector3D |
transformVector(Vector3D vector)
Transform a vector (ignoring translation effects).
|
Wrench |
transformWrench(Wrench wrench)
Transform a wrench (ignoring translation effects).
|
public static final Transform IDENTITY
public Transform(AbsoluteDate dateIn, Vector3D translation)
dateIn
- date of the transformtranslation
- the position of the "destination" frame expressed in the "origin" onepublic Transform(AbsoluteDate dateIn, Rotation rotation)
dateIn
- date of the transformrotation
- the orientation of the "destination" frame expressed in the "origin" onepublic Transform(AbsoluteDate dateIn, Vector3D translation, Vector3D velocity)
dateIn
- date of the transformtranslation
- the position of the "destination" frame expressed in the "origin" onevelocity
- the velocity of the "destination" frame expressed in the "origin" onepublic Transform(AbsoluteDate dateIn, Vector3D translation, Vector3D velocity, Vector3D acceleration)
dateIn
- date of the transformtranslation
- the position of the "destination" frame expressed in the "origin" onevelocity
- the velocity of the "destination" frame expressed in the "origin" oneacceleration
- the acceleration of the "destination" frame expressed in the "origin" onepublic Transform(AbsoluteDate dateIn, PVCoordinates cartesianIn)
dateIn
- date of the transformcartesianIn
- position and velocity of the "destination" frame expressed in the "origin" onepublic Transform(AbsoluteDate dateIn, Rotation rotation, Vector3D rotationRate)
dateIn
- date of the transformrotation
- the orientation of the "destination" frame expressed in the "origin" onerotationRate
- the rotation rate of the "destination" frame in the "origin" one, expressed in the
"destination" framepublic Transform(AbsoluteDate dateIn, Rotation rotation, Vector3D rotationRate, Vector3D rotationAcceleration)
dateIn
- date of the transformrotation
- the orientation of the "destination" frame expressed in the "origin" onerotationRate
- the rotation rate of the "destination" frame in the "origin" one, expressed in the
"destination" framerotationAcceleration
- the axis of the instant rotation
expressed in the new frame. (norm representing angular rate)public Transform(AbsoluteDate dateIn, AngularCoordinates angularIn)
dateIn
- date of the transformangularIn
- AngularCoordinates
of the "destination" frame in the "origin" onepublic Transform(AbsoluteDate dateIn, Transform first, Transform second)
Warning: spin derivative is not computed.
dateIn
- date of the transformfirst
- first transform appliedsecond
- second transform appliedpublic Transform(AbsoluteDate dateIn, Transform first, Transform second, boolean computeSpinDerivatives)
Note that the dates of the two existing transformed are ignored, and the combined transform date is set to the date supplied in this constructor without any attempt to shift the raw transforms. This is a design choice allowing user full control of the combination.
dateIn
- date of the transformfirst
- first transform appliedsecond
- second transform appliedcomputeSpinDerivatives
- true if spin derivatives should be computed. If not, spin derivative is set to nullpublic Transform(AbsoluteDate dateIn, PVCoordinates cartesianIn, AngularCoordinates angularIn)
dateIn
- date of the transformcartesianIn
- position and velocity of the "destination" frame expressed in the "origin" oneangularIn
- AngularCoordinates
of the "destination" frame in the "origin" onepublic AbsoluteDate getDate()
getDate
in interface TimeStamped
public Transform shiftedBy(double dt)
Warning: spin derivative is not computed.
shiftedBy
in interface TimeShiftable<Transform>
dt
- time shift in secondspublic Transform shiftedBy(double dt, boolean computeSpinDerivative)
dt
- time shift in secondscomputeSpinDerivative
- true if spin derivatives should be computed. If not, spin derivative is set to nullpublic Transform interpolate(AbsoluteDate interpolationDate, Collection<Transform> sample) throws PatriusException
Note that the state of the current instance may not be used in the interpolation process, only its type and non interpolable fields are used (for example central attraction coefficient or frame when interpolating orbits). The interpolable fields taken into account are taken only from the states of the sample points. So if the state of the instance must be used, the instance should be included in the sample points.
Calling this method is equivalent to call interpolate(AbsoluteDate, boolean, boolean, Collection)
with
both useVelocities
and useRotationRates
set to true.
Warning: spin derivative is not computed.
interpolate
in interface TimeInterpolable<Transform>
interpolationDate
- interpolation datesample
- sample points on which interpolation should be donePatriusException
- if the sample points are inconsistentpublic Transform interpolate(AbsoluteDate interpolationDate, Collection<Transform> sample, boolean computeSpinDerivative) throws PatriusException
Note that the state of the current instance may not be used in the interpolation process, only its type and non interpolable fields are used (for example central attraction coefficient or frame when interpolating orbits). The interpolable fields taken into account are taken only from the states of the sample points. So if the state of the instance must be used, the instance should be included in the sample points.
Calling this method is equivalent to call interpolate(AbsoluteDate, boolean, boolean, Collection)
with
both useVelocities
and useRotationRates
set to true.
interpolationDate
- interpolation datesample
- sample points on which interpolation should be donecomputeSpinDerivative
- true if spin derivatives should be computed. If not, spin derivative is set to nullPatriusException
- if the sample points are inconsistentpublic static Transform interpolate(AbsoluteDate date, boolean useVelocities, boolean useRotationRates, Collection<Transform> sample) throws PatriusException
Note that even if first time derivatives (velocities and rotation rates) from sample can be ignored, the interpolated instance always includes interpolated derivatives. This feature can be used explicitly to compute these derivatives when it would be too complex to compute them from an analytical formula: just compute a few sample points from the explicit formula and set the derivatives to zero in these sample points, then use interpolation to add derivatives consistent with the positions and rotations.
Warning: spin derivative is not computed.
date
- interpolation dateuseVelocities
- if true, use sample transforms velocities, otherwise ignore them and use only positionsuseRotationRates
- if true, use sample points rotation rates, otherwise ignore them and use only rotationssample
- sample points on which interpolation should be donePatriusException
- OrekitException if the number of point is too small for interpolatingpublic static Transform interpolate(AbsoluteDate date, boolean useVelocities, boolean useRotationRates, Collection<Transform> sample, boolean computeSpinDerivative) throws PatriusException
Note that even if first time derivatives (velocities and rotation rates) from sample can be ignored, the interpolated instance always includes interpolated derivatives. This feature can be used explicitly to compute these derivatives when it would be too complex to compute them from an analytical formula: just compute a few sample points from the explicit formula and set the derivatives to zero in these sample points, then use interpolation to add derivatives consistent with the positions and rotations.
date
- interpolation dateuseVelocities
- if true, use sample transforms velocities, otherwise ignore them and use only positionsuseRotationRates
- if true, use sample points rotation rates, otherwise ignore them and use only rotationssample
- sample points on which interpolation should be donecomputeSpinDerivative
- true if spin derivatives should be computed. If not, spin derivative is set to nullPatriusException
- if the number of point is too small for interpolatingpublic Transform getInverse(boolean computeSpinDerivatives)
computeSpinDerivatives
- true if spin derivatives should be computed. If not, spin derivative is set to nullpublic Transform getInverse()
Warning: spin derivative is not computed.
public Transform freeze()
This method creates a copy of the instance but frozen in time, i.e. with velocity, rotation rate, acceleration and rotation acceleration set to zero.
public Vector3D transformPosition(Vector3D position)
position
- vector to transformpublic Vector3D transformVector(Vector3D vector)
vector
- vector to transformpublic Wrench transformWrench(Wrench wrench)
wrench
- wrench to transformpublic Line transformLine(Line line)
line
- to transformpublic PVCoordinates transformPVCoordinates(PVCoordinates pv)
PVCoordinates
including kinematic effects from an algebraic point of view.pv
- the couple position-velocity to transform.public TimeStampedPVCoordinates transformPVCoordinates(TimeStampedPVCoordinates pv)
TimeStampedPVCoordinates
including kinematic effects.
In order to allow the user more flexibility, this method does not check for consistency between the
transform date
and the time-stamped position-velocity
date
. The returned value will always have the same
date
as the input argument, regardless of the instance
date
.
pv
- time-stamped position-velocity to transform.public void getJacobian(double[][] jacobian)
transformPVCoordinates(PVCoordinates)
method of the transform.
Element jacobian[i][j]
is the derivative of Cartesian coordinate i of the transformed
PVCoordinates
with respect to Cartesian coordinate j of the input PVCoordinates
in method
transformPVCoordinates(PVCoordinates)
.
This definition implies that if we define position-velocity coordinates
PV1 = transform.transformPVCoordinates(PV0), thentheir differentials dPV1 and dPV0 will obey the following relation where J is the matrix computed by this method:
dPV1 = J × dPV0
jacobian
- placeholder 6x6 (or larger) matrix to be filled with the Jacobian, if matrix is larger than 6x6, only
the 6x6 upper left corner will be modifiedpublic PVCoordinates getCartesian()
NB : A transform can be uniquely represented as an elementary translation followed by an elementary rotation. This method returns this unique elementary translation with its derivative.
getTranslation()
,
getVelocity()
public Vector3D getTranslation()
NB : A transform can be uniquely represented as an elementary translation followed by an elementary rotation. This method returns this unique elementary translation.
getCartesian()
,
getVelocity()
public Vector3D getVelocity()
getCartesian()
,
getTranslation()
public Vector3D getAcceleration()
getCartesian()
,
getTranslation()
,
getVelocity()
public AngularCoordinates getAngular()
NB : A transform can be uniquely represented as an elementary translation followed by an elementary rotation. This method returns this unique elementary rotation with its derivative.
getRotation()
,
getRotationRate()
public Rotation getRotation()
NB : A transform can be uniquely represented as an elementary translation followed by an elementary rotation. This method returns this unique elementary rotation.
getAngular()
,
getRotationRate()
public Vector3D getRotationRate()
The norm represents the angular rate.
getAngular()
,
getRotation()
public Vector3D getRotationAcceleration()
getAngular()
,
getRotation()
,
getRotationRate()
Copyright © 2021 CNES. All rights reserved.