Class Transform
- java.lang.Object
-
- org.orekit.frames.Transform
-
- All Implemented Interfaces:
Serializable
,TimeInterpolable<Transform>
,TimeShiftable<Transform>
,TimeStamped
public class Transform extends Object implements TimeStamped, TimeShiftable<Transform>, TimeInterpolable<Transform>, Serializable
Transformation class in three dimensional space.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.The convention used in OREKIT is vectorial transformation. It means that a transformation is defined as a transform to apply to the coordinates of a vector expressed in the old frame to obtain the same vector expressed in the new frame.
Instances of this class are guaranteed to be immutable.
Examples
Example of translation from RA to RB
We want to transform the
PVCoordinates
PVA to PVB with :PVA = ({1, 0, 0}, {2, 0, 0}, {3, 0, 0});
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(-2, 0, 0); Vector3D acceleration = new Vector3D(-3, 0, 0); Transform R1toR2 = new Transform(date, translation, velocity, acceleration); PVB = R1toR2.transformPVCoordinates(PVA);
Example of rotation from RA to RB
We want to transform the
PVCoordinates
PVA to PVB withPVA = ({1, 0, 0}, { 1, 0, 0});
PVB = ({0, 1, 0}, {-2, 1, 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(rotation, rotationRate); PVB = R1toR2.transformPVCoordinates(PVA);
- Author:
- Luc Maisonobe, Fabien Maussion
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Rotation rotation)
Build a rotation transform.Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Rotation rotation, org.hipparchus.geometry.euclidean.threed.Vector3D rotationRate)
Build a rotation transform.Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Rotation rotation, org.hipparchus.geometry.euclidean.threed.Vector3D rotationRate, org.hipparchus.geometry.euclidean.threed.Vector3D rotationAcceleration)
Build a rotation transform.Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Vector3D translation)
Build a translation transform.Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Vector3D translation, org.hipparchus.geometry.euclidean.threed.Vector3D velocity)
Build a translation transform, with its first time derivative.Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Vector3D translation, org.hipparchus.geometry.euclidean.threed.Vector3D velocity, org.hipparchus.geometry.euclidean.threed.Vector3D acceleration)
Build a translation transform, with its first and second time derivatives.Transform(AbsoluteDate date, Transform first, Transform second)
Build a transform by combining two existing ones.Transform(AbsoluteDate date, AngularCoordinates angular)
Build a rotation transform.Transform(AbsoluteDate date, PVCoordinates cartesian)
Build a translation transform, with its first time derivative.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Transform
freeze()
Get a frozen transform.org.hipparchus.geometry.euclidean.threed.Vector3D
getAcceleration()
Get the second time derivative of the translation.AngularCoordinates
getAngular()
Get the underlying elementary angular part.PVCoordinates
getCartesian()
Get the underlying elementary Cartesian part.AbsoluteDate
getDate()
Get the date.Transform
getInverse()
Get the inverse transform of the instance.void
getJacobian(CartesianDerivativesFilter selector, double[][] jacobian)
Compute the Jacobian of thetransformPVCoordinates(PVCoordinates)
method of the transform.org.hipparchus.geometry.euclidean.threed.Rotation
getRotation()
Get the underlying elementary rotation.org.hipparchus.geometry.euclidean.threed.Vector3D
getRotationAcceleration()
Get the second time derivative of the rotation.org.hipparchus.geometry.euclidean.threed.Vector3D
getRotationRate()
Get the first time derivative of the rotation.org.hipparchus.geometry.euclidean.threed.Vector3D
getTranslation()
Get the underlying elementary translation.org.hipparchus.geometry.euclidean.threed.Vector3D
getVelocity()
Get the first time derivative of the translation.Transform
interpolate(AbsoluteDate interpolationDate, Stream<Transform> sample)
Get an interpolated instance.static Transform
interpolate(AbsoluteDate date, CartesianDerivativesFilter cFilter, AngularDerivativesFilter aFilter, Collection<Transform> sample)
Interpolate a transform from a sample set of existing transforms.Transform
shiftedBy(double dt)
Get a time-shifted instance.org.hipparchus.geometry.euclidean.threed.Line
transformLine(org.hipparchus.geometry.euclidean.threed.Line line)
Transform a line.<T extends org.hipparchus.RealFieldElement<T>>
org.hipparchus.geometry.euclidean.threed.FieldVector3D<T>transformPosition(org.hipparchus.geometry.euclidean.threed.FieldVector3D<T> position)
Transform a position vector (including translation effects).org.hipparchus.geometry.euclidean.threed.Vector3D
transformPosition(org.hipparchus.geometry.euclidean.threed.Vector3D position)
Transform a position vector (including translation effects).<T extends org.hipparchus.RealFieldElement<T>>
FieldPVCoordinates<T>transformPVCoordinates(FieldPVCoordinates<T> pv)
TransformFieldPVCoordinates
including kinematic effects.PVCoordinates
transformPVCoordinates(PVCoordinates pva)
TransformPVCoordinates
including kinematic effects.<T extends org.hipparchus.RealFieldElement<T>>
TimeStampedFieldPVCoordinates<T>transformPVCoordinates(TimeStampedFieldPVCoordinates<T> pv)
TransformTimeStampedFieldPVCoordinates
including kinematic effects.TimeStampedPVCoordinates
transformPVCoordinates(TimeStampedPVCoordinates pv)
TransformTimeStampedPVCoordinates
including kinematic effects.<T extends org.hipparchus.RealFieldElement<T>>
org.hipparchus.geometry.euclidean.threed.FieldVector3D<T>transformVector(org.hipparchus.geometry.euclidean.threed.FieldVector3D<T> vector)
Transform a vector (ignoring translation effects).org.hipparchus.geometry.euclidean.threed.Vector3D
transformVector(org.hipparchus.geometry.euclidean.threed.Vector3D vector)
Transform a vector (ignoring translation effects).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.orekit.time.TimeInterpolable
interpolate
-
-
-
-
Field Detail
-
IDENTITY
public static final Transform IDENTITY
Identity transform.
-
-
Constructor Detail
-
Transform
public Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Vector3D translation)
Build a translation transform.- Parameters:
date
- date of the transformtranslation
- translation to apply (i.e. coordinates of the transformed origin, or coordinates of the origin of the old frame in the new frame)
-
Transform
public Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Rotation rotation)
Build a rotation transform.- Parameters:
date
- date of the transformrotation
- rotation to apply ( i.e. rotation to apply to the coordinates of a vector expressed in the old frame to obtain the same vector expressed in the new frame )
-
Transform
public Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Vector3D translation, org.hipparchus.geometry.euclidean.threed.Vector3D velocity)
Build a translation transform, with its first time derivative.- Parameters:
date
- date of the transformtranslation
- translation to apply (i.e. coordinates of the transformed origin, or coordinates of the origin of the old frame in the new frame)velocity
- the velocity of the translation (i.e. origin of the old frame velocity in the new frame)
-
Transform
public Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Vector3D translation, org.hipparchus.geometry.euclidean.threed.Vector3D velocity, org.hipparchus.geometry.euclidean.threed.Vector3D acceleration)
Build a translation transform, with its first and second time derivatives.- Parameters:
date
- date of the transformtranslation
- translation to apply (i.e. coordinates of the transformed origin, or coordinates of the origin of the old frame in the new frame)velocity
- the velocity of the translation (i.e. origin of the old frame velocity in the new frame)acceleration
- the acceleration of the translation (i.e. origin of the old frame acceleration in the new frame)
-
Transform
public Transform(AbsoluteDate date, PVCoordinates cartesian)
Build a translation transform, with its first time derivative.- Parameters:
date
- date of the transformcartesian
- Cartesian part of the transformation to apply (i.e. coordinates of the transformed origin, or coordinates of the origin of the old frame in the new frame, with their derivatives)
-
Transform
public Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Rotation rotation, org.hipparchus.geometry.euclidean.threed.Vector3D rotationRate)
Build a rotation transform.- Parameters:
date
- date of the transformrotation
- rotation to apply ( i.e. rotation to apply to the coordinates of a vector expressed in the old frame to obtain the same vector expressed in the new frame )rotationRate
- the axis of the instant rotation expressed in the new frame. (norm representing angular rate)
-
Transform
public Transform(AbsoluteDate date, org.hipparchus.geometry.euclidean.threed.Rotation rotation, org.hipparchus.geometry.euclidean.threed.Vector3D rotationRate, org.hipparchus.geometry.euclidean.threed.Vector3D rotationAcceleration)
Build a rotation transform.- Parameters:
date
- date of the transformrotation
- rotation to apply ( i.e. rotation to apply to the coordinates of a vector expressed in the old frame to obtain the same vector expressed in the new frame )rotationRate
- the axis of the instant rotationrotationAcceleration
- the axis of the instant rotation expressed in the new frame. (norm representing angular rate)
-
Transform
public Transform(AbsoluteDate date, AngularCoordinates angular)
Build a rotation transform.- Parameters:
date
- date of the transformangular
- angular part of the transformation to apply (i.e. rotation to apply to the coordinates of a vector expressed in the old frame to obtain the same vector expressed in the new frame, with its rotation rate)
-
Transform
public Transform(AbsoluteDate date, Transform first, Transform second)
Build a transform by combining two existing ones.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.
- Parameters:
date
- date of the transformfirst
- first transform appliedsecond
- second transform applied
-
-
Method Detail
-
getDate
public AbsoluteDate getDate()
Get the date.- Specified by:
getDate
in interfaceTimeStamped
- Returns:
- date attached to the object
-
shiftedBy
public Transform shiftedBy(double dt)
Get a time-shifted instance.- Specified by:
shiftedBy
in interfaceTimeShiftable<Transform>
- Parameters:
dt
- time shift in seconds- Returns:
- a new instance, shifted with respect to instance (which is not changed)
-
interpolate
public Transform interpolate(AbsoluteDate interpolationDate, Stream<Transform> sample)
Get an interpolated instance.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.
Note that this method is designed for small samples only (say up to about 10-20 points) so it can be implemented using polynomial interpolation (typically Hermite interpolation). Using too much points may induce Runge's phenomenon and numerical problems (including NaN appearing).
Calling this method is equivalent to call
interpolate(AbsoluteDate, CartesianDerivativesFilter, AngularDerivativesFilter, Collection)
withcFilter
set toCartesianDerivativesFilter.USE_PVA
andaFilter
set toAngularDerivativesFilter.USE_RRA
set to true.- Specified by:
interpolate
in interfaceTimeInterpolable<Transform>
- Parameters:
interpolationDate
- interpolation datesample
- sample points on which interpolation should be done- Returns:
- a new instance, interpolated at specified date
-
interpolate
public static Transform interpolate(AbsoluteDate date, CartesianDerivativesFilter cFilter, AngularDerivativesFilter aFilter, Collection<Transform> sample)
Interpolate a transform from a sample set of existing transforms.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.
As this implementation of interpolation is polynomial, it should be used only with small samples (about 10-20 points) in order to avoid Runge's phenomenon and numerical problems (including NaN appearing).
- Parameters:
date
- interpolation datecFilter
- filter for derivatives from the sample to use in interpolationaFilter
- filter for derivatives from the sample to use in interpolationsample
- sample points on which interpolation should be done- Returns:
- a new instance, interpolated at specified date
- Since:
- 7.0
-
getInverse
public Transform getInverse()
Get the inverse transform of the instance.- Returns:
- inverse transform of the instance
-
freeze
public Transform freeze()
Get a frozen transform.This method creates a copy of the instance but frozen in time, i.e. with velocity, acceleration and rotation rate forced to zero.
- Returns:
- a new transform, without any time-dependent parts
-
transformPosition
public org.hipparchus.geometry.euclidean.threed.Vector3D transformPosition(org.hipparchus.geometry.euclidean.threed.Vector3D position)
Transform a position vector (including translation effects).- Parameters:
position
- vector to transform- Returns:
- transformed position
-
transformPosition
public <T extends org.hipparchus.RealFieldElement<T>> org.hipparchus.geometry.euclidean.threed.FieldVector3D<T> transformPosition(org.hipparchus.geometry.euclidean.threed.FieldVector3D<T> position)
Transform a position vector (including translation effects).- Type Parameters:
T
- the type of the field elements- Parameters:
position
- vector to transform- Returns:
- transformed position
-
transformVector
public org.hipparchus.geometry.euclidean.threed.Vector3D transformVector(org.hipparchus.geometry.euclidean.threed.Vector3D vector)
Transform a vector (ignoring translation effects).- Parameters:
vector
- vector to transform- Returns:
- transformed vector
-
transformVector
public <T extends org.hipparchus.RealFieldElement<T>> org.hipparchus.geometry.euclidean.threed.FieldVector3D<T> transformVector(org.hipparchus.geometry.euclidean.threed.FieldVector3D<T> vector)
Transform a vector (ignoring translation effects).- Type Parameters:
T
- the type of the field elements- Parameters:
vector
- vector to transform- Returns:
- transformed vector
-
transformLine
public org.hipparchus.geometry.euclidean.threed.Line transformLine(org.hipparchus.geometry.euclidean.threed.Line line)
Transform a line.- Parameters:
line
- to transform- Returns:
- transformed line
-
transformPVCoordinates
public PVCoordinates transformPVCoordinates(PVCoordinates pva)
TransformPVCoordinates
including kinematic effects.- Parameters:
pva
- the position-velocity-acceleration triplet to transform.- Returns:
- transformed position-velocity-acceleration
-
transformPVCoordinates
public TimeStampedPVCoordinates transformPVCoordinates(TimeStampedPVCoordinates pv)
TransformTimeStampedPVCoordinates
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-velocitydate
. The returned value will always have the samedate
as the input argument, regardless of the instancedate
.- Parameters:
pv
- time-stamped position-velocity to transform.- Returns:
- transformed time-stamped position-velocity
- Since:
- 7.0
-
transformPVCoordinates
public <T extends org.hipparchus.RealFieldElement<T>> FieldPVCoordinates<T> transformPVCoordinates(FieldPVCoordinates<T> pv)
TransformFieldPVCoordinates
including kinematic effects.- Type Parameters:
T
- type of the field elements- Parameters:
pv
- position-velocity to transform.- Returns:
- transformed position-velocity
-
transformPVCoordinates
public <T extends org.hipparchus.RealFieldElement<T>> TimeStampedFieldPVCoordinates<T> transformPVCoordinates(TimeStampedFieldPVCoordinates<T> pv)
TransformTimeStampedFieldPVCoordinates
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-velocitydate
. The returned value will always have the samedate
as the input argument, regardless of the instancedate
.- Type Parameters:
T
- type of the field elements- Parameters:
pv
- time-stamped position-velocity to transform.- Returns:
- transformed time-stamped position-velocity
- Since:
- 7.0
-
getJacobian
public void getJacobian(CartesianDerivativesFilter selector, double[][] jacobian)
Compute the Jacobian of thetransformPVCoordinates(PVCoordinates)
method of the transform.Element
jacobian[i][j]
is the derivative of Cartesian coordinate i of the transformedPVCoordinates
with respect to Cartesian coordinate j of the inputPVCoordinates
in methodtransformPVCoordinates(PVCoordinates)
.This definition implies that if we define position-velocity coordinates
PV₁ = transform.transformPVCoordinates(PV₀), then
their differentials dPV₁ and dPV₀ will obey the following relation where J is the matrix computed by this method:
dPV₁ = J × dPV₀
- Parameters:
selector
- selector specifying the size of the upper left corner that must be filled (either 3x3 for positions only, 6x6 for positions and velocities, 9x9 for positions, velocities and accelerations)jacobian
- placeholder matrix whose upper-left corner is to be filled with the Jacobian, the rest of the matrix remaining untouched
-
getCartesian
public PVCoordinates getCartesian()
Get the underlying elementary Cartesian part.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.
- Returns:
- underlying elementary Cartesian part
- See Also:
getTranslation()
,getVelocity()
-
getTranslation
public org.hipparchus.geometry.euclidean.threed.Vector3D getTranslation()
Get the underlying elementary translation.A transform can be uniquely represented as an elementary translation followed by an elementary rotation. This method returns this unique elementary translation.
- Returns:
- underlying elementary translation
- See Also:
getCartesian()
,getVelocity()
,getAcceleration()
-
getVelocity
public org.hipparchus.geometry.euclidean.threed.Vector3D getVelocity()
Get the first time derivative of the translation.- Returns:
- first time derivative of the translation
- See Also:
getCartesian()
,getTranslation()
,getAcceleration()
-
getAcceleration
public org.hipparchus.geometry.euclidean.threed.Vector3D getAcceleration()
Get the second time derivative of the translation.- Returns:
- second time derivative of the translation
- See Also:
getCartesian()
,getTranslation()
,getVelocity()
-
getAngular
public AngularCoordinates getAngular()
Get the underlying elementary angular part.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.
- Returns:
- underlying elementary angular part
- See Also:
getRotation()
,getRotationRate()
,getRotationAcceleration()
-
getRotation
public org.hipparchus.geometry.euclidean.threed.Rotation getRotation()
Get the underlying elementary rotation.A transform can be uniquely represented as an elementary translation followed by an elementary rotation. This method returns this unique elementary rotation.
- Returns:
- underlying elementary rotation
- See Also:
getAngular()
,getRotationRate()
,getRotationAcceleration()
-
getRotationRate
public org.hipparchus.geometry.euclidean.threed.Vector3D getRotationRate()
Get the first time derivative of the rotation.The norm represents the angular rate.
- Returns:
- First time derivative of the rotation
- See Also:
getAngular()
,getRotation()
,getRotationAcceleration()
-
getRotationAcceleration
public org.hipparchus.geometry.euclidean.threed.Vector3D getRotationAcceleration()
Get the second time derivative of the rotation.- Returns:
- Second time derivative of the rotation
- See Also:
getAngular()
,getRotation()
,getRotationRate()
-
-