Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Orekit
Orekit
Commits
fe31ff66
Commit
fe31ff66
authored
Jan 26, 2021
by
Luc Maisonobe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow building {PV, Angular}Coordinates from any derivatives type.
Fixed
#749
parent
5a5233c6
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1212 additions
and
96 deletions
+1212
-96
src/changes/changes.xml
src/changes/changes.xml
+6
-1
src/main/java/org/orekit/utils/AbsolutePVCoordinates.java
src/main/java/org/orekit/utils/AbsolutePVCoordinates.java
+5
-4
src/main/java/org/orekit/utils/AngularCoordinates.java
src/main/java/org/orekit/utils/AngularCoordinates.java
+63
-2
src/main/java/org/orekit/utils/FieldAbsolutePVCoordinates.java
...ain/java/org/orekit/utils/FieldAbsolutePVCoordinates.java
+4
-4
src/main/java/org/orekit/utils/FieldAngularCoordinates.java
src/main/java/org/orekit/utils/FieldAngularCoordinates.java
+57
-9
src/main/java/org/orekit/utils/FieldPVCoordinates.java
src/main/java/org/orekit/utils/FieldPVCoordinates.java
+3
-1
src/main/java/org/orekit/utils/PVCoordinates.java
src/main/java/org/orekit/utils/PVCoordinates.java
+4
-2
src/main/java/org/orekit/utils/TimeStampedAngularCoordinates.java
.../java/org/orekit/utils/TimeStampedAngularCoordinates.java
+5
-4
src/main/java/org/orekit/utils/TimeStampedFieldAngularCoordinates.java
.../org/orekit/utils/TimeStampedFieldAngularCoordinates.java
+4
-2
src/main/java/org/orekit/utils/TimeStampedFieldPVCoordinates.java
.../java/org/orekit/utils/TimeStampedFieldPVCoordinates.java
+4
-3
src/main/java/org/orekit/utils/TimeStampedPVCoordinates.java
src/main/java/org/orekit/utils/TimeStampedPVCoordinates.java
+4
-4
src/test/java/org/orekit/utils/AbsolutePVCoordinatesTest.java
...test/java/org/orekit/utils/AbsolutePVCoordinatesTest.java
+155
-0
src/test/java/org/orekit/utils/AngularCoordinatesTest.java
src/test/java/org/orekit/utils/AngularCoordinatesTest.java
+37
-1
src/test/java/org/orekit/utils/FieldAbsolutePVCoordinatesTest.java
...java/org/orekit/utils/FieldAbsolutePVCoordinatesTest.java
+201
-26
src/test/java/org/orekit/utils/FieldAngularCoordinatesTest.java
...st/java/org/orekit/utils/FieldAngularCoordinatesTest.java
+38
-1
src/test/java/org/orekit/utils/FieldPVCoordinatesTest.java
src/test/java/org/orekit/utils/FieldPVCoordinatesTest.java
+33
-0
src/test/java/org/orekit/utils/PVCoordinatesTest.java
src/test/java/org/orekit/utils/PVCoordinatesTest.java
+59
-26
src/test/java/org/orekit/utils/TimeStampedAngularCoordinatesTest.java
...a/org/orekit/utils/TimeStampedAngularCoordinatesTest.java
+93
-6
src/test/java/org/orekit/utils/TimeStampedFieldAngularCoordinatesTest.java
.../orekit/utils/TimeStampedFieldAngularCoordinatesTest.java
+147
-0
src/test/java/org/orekit/utils/TimeStampedFieldPVCoordinatesTest.java
...a/org/orekit/utils/TimeStampedFieldPVCoordinatesTest.java
+152
-0
src/test/java/org/orekit/utils/TimeStampedPVCoordinatesTest.java
...t/java/org/orekit/utils/TimeStampedPVCoordinatesTest.java
+138
-0
No files found.
src/changes/changes.xml
View file @
fe31ff66
...
...
@@ -21,8 +21,13 @@
</properties>
<body>
<release
version=
"11.0"
date=
"TBD"
description=
"TBD"
>
<action
dev=
"luc"
type=
"fix"
issue=
"749"
>
Allow building PVCoordinates and AngularCoordinates (as well as their Field,
Absolute and TimeStamped variations) to be build from UnivariateDerivative1
and UnivariateDerivative2 in addition to DerivativeStructure.
</action>
<action
dev=
"bryan"
type=
"fix"
issue=
"736"
>
Fixed NullPointerException in DSSTTesseral Hansen object.
Fixed NullPointerException in DSSTTesseral Hansen object.
</action>
<action
dev=
"bryan"
type=
"update"
issue=
"601"
>
Changed getPVInPZ90() method to private.
...
...
src/main/java/org/orekit/utils/AbsolutePVCoordinates.java
View file @
fe31ff66
...
...
@@ -19,7 +19,7 @@ package org.orekit.utils;
import
java.io.Serializable
;
import
java.util.stream.Stream
;
import
org.hipparchus.analysis.differentiation.Derivative
Structure
;
import
org.hipparchus.analysis.differentiation.Derivative
;
import
org.hipparchus.analysis.interpolation.HermiteInterpolator
;
import
org.hipparchus.geometry.euclidean.threed.FieldVector3D
;
import
org.hipparchus.geometry.euclidean.threed.Vector3D
;
...
...
@@ -192,7 +192,7 @@ public class AbsolutePVCoordinates extends TimeStampedPVCoordinates
this
.
frame
=
absPv1
.
getFrame
();
}
/** Builds a AbsolutePVCoordinates triplet from a {@link FieldVector3D}<{@link Derivative
Structure
}>.
/** Builds a AbsolutePVCoordinates triplet from a {@link FieldVector3D}<{@link Derivative}>.
* <p>
* The vector components must have time as their only derivation parameter and
* have consistent derivation orders.
...
...
@@ -200,9 +200,10 @@ public class AbsolutePVCoordinates extends TimeStampedPVCoordinates
* @param frame the frame in which the parameters are defined
* @param date date of the built coordinates
* @param p vector with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
*/
public
AbsolutePVCoordinates
(
final
Frame
frame
,
final
AbsoluteDate
date
,
final
FieldVector3D
<
DerivativeStructure
>
p
)
{
public
<
U
extends
Derivative
<
U
>>
AbsolutePVCoordinates
(
final
Frame
frame
,
final
AbsoluteDate
date
,
final
FieldVector3D
<
U
>
p
)
{
super
(
date
,
p
);
this
.
frame
=
frame
;
}
...
...
src/main/java/org/orekit/utils/AngularCoordinates.java
View file @
fe31ff66
...
...
@@ -20,8 +20,10 @@ import java.io.Serializable;
import
org.hipparchus.RealFieldElement
;
import
org.hipparchus.analysis.differentiation.DSFactory
;
import
org.hipparchus.analysis.differentiation.Derivative
;
import
org.hipparchus.analysis.differentiation.DerivativeStructure
;
import
org.hipparchus.analysis.differentiation.UnivariateDerivative1
;
import
org.hipparchus.analysis.differentiation.UnivariateDerivative2
;
import
org.hipparchus.exception.LocalizedCoreFormats
;
import
org.hipparchus.exception.MathIllegalArgumentException
;
import
org.hipparchus.exception.MathRuntimeException
;
...
...
@@ -175,14 +177,15 @@ public class AngularCoordinates implements TimeShiftable<AngularCoordinates>, Se
v
.
toDerivativeStructureVector
(
2
)));
}
/** Builds a AngularCoordinates from a {@link FieldRotation}<{@link Derivative
Structure
}>.
/** Builds a AngularCoordinates from a {@link FieldRotation}<{@link Derivative}>.
* <p>
* The rotation components must have time as their only derivation parameter and
* have consistent derivation orders.
* </p>
* @param r rotation with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
*/
public
AngularCoordinates
(
final
FieldRotation
<
DerivativeStructure
>
r
)
{
public
<
U
extends
Derivative
<
U
>>
AngularCoordinates
(
final
FieldRotation
<
U
>
r
)
{
final
double
q0
=
r
.
getQ0
().
getReal
();
final
double
q1
=
r
.
getQ1
().
getReal
();
...
...
@@ -438,6 +441,64 @@ public class AngularCoordinates implements TimeShiftable<AngularCoordinates>, Se
}
/** Transform the instance to a {@link FieldRotation}<{@link UnivariateDerivative2}>.
* <p>
* The {@link UnivariateDerivative2} coordinates correspond to time-derivatives up
* to the order 2.
* </p>
* @return rotation with time-derivatives embedded within the coordinates
*/
public
FieldRotation
<
UnivariateDerivative2
>
toUnivariateDerivative2Rotation
()
{
// quaternion components
final
double
q0
=
rotation
.
getQ0
();
final
double
q1
=
rotation
.
getQ1
();
final
double
q2
=
rotation
.
getQ2
();
final
double
q3
=
rotation
.
getQ3
();
// first time-derivatives of the quaternion
final
double
oX
=
rotationRate
.
getX
();
final
double
oY
=
rotationRate
.
getY
();
final
double
oZ
=
rotationRate
.
getZ
();
final
double
q0Dot
=
0.5
*
MathArrays
.
linearCombination
(-
q1
,
oX
,
-
q2
,
oY
,
-
q3
,
oZ
);
final
double
q1Dot
=
0.5
*
MathArrays
.
linearCombination
(
q0
,
oX
,
-
q3
,
oY
,
q2
,
oZ
);
final
double
q2Dot
=
0.5
*
MathArrays
.
linearCombination
(
q3
,
oX
,
q0
,
oY
,
-
q1
,
oZ
);
final
double
q3Dot
=
0.5
*
MathArrays
.
linearCombination
(-
q2
,
oX
,
q1
,
oY
,
q0
,
oZ
);
// second time-derivatives of the quaternion
final
double
oXDot
=
rotationAcceleration
.
getX
();
final
double
oYDot
=
rotationAcceleration
.
getY
();
final
double
oZDot
=
rotationAcceleration
.
getZ
();
final
double
q0DotDot
=
-
0.5
*
MathArrays
.
linearCombination
(
new
double
[]
{
q1
,
q2
,
q3
,
q1Dot
,
q2Dot
,
q3Dot
},
new
double
[]
{
oXDot
,
oYDot
,
oZDot
,
oX
,
oY
,
oZ
});
final
double
q1DotDot
=
0.5
*
MathArrays
.
linearCombination
(
new
double
[]
{
q0
,
q2
,
-
q3
,
q0Dot
,
q2Dot
,
-
q3Dot
},
new
double
[]
{
oXDot
,
oZDot
,
oYDot
,
oX
,
oZ
,
oY
});
final
double
q2DotDot
=
0.5
*
MathArrays
.
linearCombination
(
new
double
[]
{
q0
,
q3
,
-
q1
,
q0Dot
,
q3Dot
,
-
q1Dot
},
new
double
[]
{
oYDot
,
oXDot
,
oZDot
,
oY
,
oX
,
oZ
});
final
double
q3DotDot
=
0.5
*
MathArrays
.
linearCombination
(
new
double
[]
{
q0
,
q1
,
-
q2
,
q0Dot
,
q1Dot
,
-
q2Dot
},
new
double
[]
{
oZDot
,
oYDot
,
oXDot
,
oZ
,
oY
,
oX
});
final
UnivariateDerivative2
q0UD
=
new
UnivariateDerivative2
(
q0
,
q0Dot
,
q0DotDot
);
final
UnivariateDerivative2
q1UD
=
new
UnivariateDerivative2
(
q1
,
q1Dot
,
q1DotDot
);
final
UnivariateDerivative2
q2UD
=
new
UnivariateDerivative2
(
q2
,
q2Dot
,
q2DotDot
);
final
UnivariateDerivative2
q3UD
=
new
UnivariateDerivative2
(
q3
,
q3Dot
,
q3DotDot
);
return
new
FieldRotation
<>(
q0UD
,
q1UD
,
q2UD
,
q3UD
,
false
);
}
/** Estimate rotation rate between two orientations.
* <p>Estimation is based on a simple fixed rate rotation
* during the time interval between the two orientations.</p>
...
...
src/main/java/org/orekit/utils/FieldAbsolutePVCoordinates.java
View file @
fe31ff66
...
...
@@ -19,8 +19,7 @@ package org.orekit.utils;
import
java.util.stream.Stream
;
import
org.hipparchus.RealFieldElement
;
import
org.hipparchus.analysis.differentiation.DerivativeStructure
;
import
org.hipparchus.analysis.differentiation.FieldDerivativeStructure
;
import
org.hipparchus.analysis.differentiation.FieldDerivative
;
import
org.hipparchus.analysis.interpolation.FieldHermiteInterpolator
;
import
org.hipparchus.geometry.euclidean.threed.FieldVector3D
;
import
org.orekit.errors.OrekitException
;
...
...
@@ -196,9 +195,10 @@ public class FieldAbsolutePVCoordinates<T extends RealFieldElement<T>> extends T
* @param frame the frame in which the parameters are defined
* @param date date of the built coordinates
* @param p vector with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
*/
public
FieldAbsolutePVCoordinates
(
final
Frame
frame
,
final
FieldAbsoluteDate
<
T
>
date
,
final
FieldVector3D
<
FieldDerivativeStructure
<
T
>
>
p
)
{
public
<
U
extends
FieldDerivative
<
T
,
U
>>
FieldAbsolutePVCoordinates
(
final
Frame
frame
,
final
FieldAbsoluteDate
<
T
>
date
,
final
FieldVector3D
<
U
>
p
)
{
super
(
date
,
p
);
this
.
frame
=
frame
;
}
...
...
src/main/java/org/orekit/utils/FieldAngularCoordinates.java
View file @
fe31ff66
...
...
@@ -18,11 +18,13 @@ package org.orekit.utils;
import
org.hipparchus.Field
;
import
org.hipparchus.RealFieldElement
;
import
org.hipparchus.analysis.differentiation.DerivativeStructure
;
import
org.hipparchus.analysis.differentiation.FDSFactory
;
import
org.hipparchus.analysis.differentiation.FieldDerivative
;
import
org.hipparchus.analysis.differentiation.FieldDerivativeStructure
;
import
org.hipparchus.analysis.differentiation.FieldUnivariateDerivative1
;
import
org.hipparchus.analysis.differentiation.FieldUnivariateDerivative2
;
import
org.hipparchus.analysis.differentiation.UnivariateDerivative1
;
import
org.hipparchus.analysis.differentiation.UnivariateDerivative2
;
import
org.hipparchus.exception.LocalizedCoreFormats
;
import
org.hipparchus.exception.MathIllegalArgumentException
;
import
org.hipparchus.geometry.euclidean.threed.FieldRotation
;
...
...
@@ -167,9 +169,10 @@ public class FieldAngularCoordinates<T extends RealFieldElement<T>> {
* have consistent derivation orders.
* </p>
* @param r rotation with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
* @since 9.2
*/
public
FieldAngularCoordinates
(
final
FieldRotation
<
FieldDerivativeStructure
<
T
>
>
r
)
{
public
<
U
extends
FieldDerivative
<
T
,
U
>>
FieldAngularCoordinates
(
final
FieldRotation
<
U
>
r
)
{
final
T
q0
=
r
.
getQ0
().
getValue
();
final
T
q1
=
r
.
getQ1
().
getValue
();
...
...
@@ -334,7 +337,7 @@ public class FieldAngularCoordinates<T extends RealFieldElement<T>> {
/** Transform the instance to a {@link FieldRotation}<{@link FieldDerivativeStructure}>.
* <p>
* The {@link DerivativeStructure} coordinates correspond to time-derivatives up
* The {@link
Field
DerivativeStructure} coordinates correspond to time-derivatives up
* to the user-specified order.
* </p>
* @param order derivation order for the vector components
...
...
@@ -363,14 +366,13 @@ public class FieldAngularCoordinates<T extends RealFieldElement<T>> {
final
T
oYDot
=
rotationAcceleration
.
getY
();
final
T
oZDot
=
rotationAcceleration
.
getZ
();
final
T
q0DotDot
=
q0
.
linearCombination
(
array6
(
q1
,
q2
,
q3
,
q1Dot
,
q2Dot
,
q3Dot
),
array6
(
oXDot
,
oYDot
,
oZDot
,
oX
,
oY
,
oZ
)).
multiply
(-
0.5
);
array6
(
oXDot
,
oYDot
,
oZDot
,
oX
,
oY
,
oZ
)).
multiply
(-
0.5
);
final
T
q1DotDot
=
q0
.
linearCombination
(
array6
(
q0
,
q2
,
q3
.
negate
(),
q0Dot
,
q2Dot
,
q3Dot
.
negate
()),
array6
(
oXDot
,
oZDot
,
oYDot
,
oX
,
oZ
,
oY
)).
multiply
(
0.5
);
final
T
q2DotDot
=
q0
.
linearCombination
(
array6
(
q0
,
q3
,
q1
.
negate
(),
q0Dot
,
q3Dot
,
q1Dot
.
negate
()),
array6
(
oYDot
,
oXDot
,
oZDot
,
oY
,
oX
,
oZ
)).
multiply
(
0.5
);
final
T
q3DotDot
=
q0
.
linearCombination
(
array6
(
q0
,
q1
,
q2
.
negate
(),
q0Dot
,
q1Dot
,
q2Dot
.
negate
()),
array6
(
oZDot
,
oYDot
,
oXDot
,
oZ
,
oY
,
oX
)).
multiply
(
0.5
);
final
T
q2DotDot
=
q0
.
linearCombination
(
array6
(
q0
,
q3
,
q1
.
negate
(),
q0Dot
,
q3Dot
,
q1Dot
.
negate
()),
array6
(
oYDot
,
oXDot
,
oZDot
,
oY
,
oX
,
oZ
)).
multiply
(
0.5
);
final
T
q3DotDot
=
q0
.
linearCombination
(
array6
(
q0
,
q1
,
q2
.
negate
(),
q0Dot
,
q1Dot
,
q2Dot
.
negate
()),
array6
(
oZDot
,
oYDot
,
oXDot
,
oZ
,
oY
,
oX
)).
multiply
(
0.5
);
final
FDSFactory
<
T
>
factory
;
final
FieldDerivativeStructure
<
T
>
q0DS
;
...
...
@@ -440,6 +442,52 @@ public class FieldAngularCoordinates<T extends RealFieldElement<T>> {
}
/** Transform the instance to a {@link FieldRotation}<{@link UnivariateDerivative2}>.
* <p>
* The {@link UnivariateDerivative2} coordinates correspond to time-derivatives up
* to the order 2.
* </p>
* @return rotation with time-derivatives embedded within the coordinates
*/
public
FieldRotation
<
FieldUnivariateDerivative2
<
T
>>
toUnivariateDerivative2Rotation
()
{
// quaternion components
final
T
q0
=
rotation
.
getQ0
();
final
T
q1
=
rotation
.
getQ1
();
final
T
q2
=
rotation
.
getQ2
();
final
T
q3
=
rotation
.
getQ3
();
// first time-derivatives of the quaternion
final
T
oX
=
rotationRate
.
getX
();
final
T
oY
=
rotationRate
.
getY
();
final
T
oZ
=
rotationRate
.
getZ
();
final
T
q0Dot
=
q0
.
linearCombination
(
q1
.
negate
(),
oX
,
q2
.
negate
(),
oY
,
q3
.
negate
(),
oZ
).
multiply
(
0.5
);
final
T
q1Dot
=
q0
.
linearCombination
(
q0
,
oX
,
q3
.
negate
(),
oY
,
q2
,
oZ
).
multiply
(
0.5
);
final
T
q2Dot
=
q0
.
linearCombination
(
q3
,
oX
,
q0
,
oY
,
q1
.
negate
(),
oZ
).
multiply
(
0.5
);
final
T
q3Dot
=
q0
.
linearCombination
(
q2
.
negate
(),
oX
,
q1
,
oY
,
q0
,
oZ
).
multiply
(
0.5
);
// second time-derivatives of the quaternion
final
T
oXDot
=
rotationAcceleration
.
getX
();
final
T
oYDot
=
rotationAcceleration
.
getY
();
final
T
oZDot
=
rotationAcceleration
.
getZ
();
final
T
q0DotDot
=
q0
.
linearCombination
(
array6
(
q1
,
q2
,
q3
,
q1Dot
,
q2Dot
,
q3Dot
),
array6
(
oXDot
,
oYDot
,
oZDot
,
oX
,
oY
,
oZ
)).
multiply
(-
0.5
);
final
T
q1DotDot
=
q0
.
linearCombination
(
array6
(
q0
,
q2
,
q3
.
negate
(),
q0Dot
,
q2Dot
,
q3Dot
.
negate
()),
array6
(
oXDot
,
oZDot
,
oYDot
,
oX
,
oZ
,
oY
)).
multiply
(
0.5
);
final
T
q2DotDot
=
q0
.
linearCombination
(
array6
(
q0
,
q3
,
q1
.
negate
(),
q0Dot
,
q3Dot
,
q1Dot
.
negate
()),
array6
(
oYDot
,
oXDot
,
oZDot
,
oY
,
oX
,
oZ
)).
multiply
(
0.5
);
final
T
q3DotDot
=
q0
.
linearCombination
(
array6
(
q0
,
q1
,
q2
.
negate
(),
q0Dot
,
q1Dot
,
q2Dot
.
negate
()),
array6
(
oZDot
,
oYDot
,
oXDot
,
oZ
,
oY
,
oX
)).
multiply
(
0.5
);
final
FieldUnivariateDerivative2
<
T
>
q0UD
=
new
FieldUnivariateDerivative2
<>(
q0
,
q0Dot
,
q0DotDot
);
final
FieldUnivariateDerivative2
<
T
>
q1UD
=
new
FieldUnivariateDerivative2
<>(
q1
,
q1Dot
,
q1DotDot
);
final
FieldUnivariateDerivative2
<
T
>
q2UD
=
new
FieldUnivariateDerivative2
<>(
q2
,
q2Dot
,
q2DotDot
);
final
FieldUnivariateDerivative2
<
T
>
q3UD
=
new
FieldUnivariateDerivative2
<>(
q3
,
q3Dot
,
q3DotDot
);
return
new
FieldRotation
<>(
q0UD
,
q1UD
,
q2UD
,
q3UD
,
false
);
}
/** Build an arry of 6 elements.
* @param e1 first element
* @param e2 second element
...
...
src/main/java/org/orekit/utils/FieldPVCoordinates.java
View file @
fe31ff66
...
...
@@ -19,6 +19,7 @@ package org.orekit.utils;
import
org.hipparchus.Field
;
import
org.hipparchus.RealFieldElement
;
import
org.hipparchus.analysis.differentiation.FDSFactory
;
import
org.hipparchus.analysis.differentiation.FieldDerivative
;
import
org.hipparchus.analysis.differentiation.FieldDerivativeStructure
;
import
org.hipparchus.analysis.differentiation.FieldUnivariateDerivative1
;
import
org.hipparchus.analysis.differentiation.FieldUnivariateDerivative2
;
...
...
@@ -308,9 +309,10 @@ public class FieldPVCoordinates<T extends RealFieldElement<T>>
* have consistent derivation orders.
* </p>
* @param p vector with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
* @since 9.2
*/
public
FieldPVCoordinates
(
final
FieldVector3D
<
FieldDerivativeStructure
<
T
>
>
p
)
{
public
<
U
extends
FieldDerivative
<
T
,
U
>>
FieldPVCoordinates
(
final
FieldVector3D
<
U
>
p
)
{
position
=
new
FieldVector3D
<>(
p
.
getX
().
getValue
(),
p
.
getY
().
getValue
(),
p
.
getZ
().
getValue
());
if
(
p
.
getX
().
getOrder
()
>=
1
)
{
velocity
=
new
FieldVector3D
<>(
p
.
getX
().
getPartialDerivative
(
1
),
...
...
src/main/java/org/orekit/utils/PVCoordinates.java
View file @
fe31ff66
...
...
@@ -19,6 +19,7 @@ package org.orekit.utils;
import
java.io.Serializable
;
import
org.hipparchus.analysis.differentiation.DSFactory
;
import
org.hipparchus.analysis.differentiation.Derivative
;
import
org.hipparchus.analysis.differentiation.DerivativeStructure
;
import
org.hipparchus.analysis.differentiation.UnivariateDerivative1
;
import
org.hipparchus.analysis.differentiation.UnivariateDerivative2
;
...
...
@@ -172,14 +173,15 @@ public class PVCoordinates implements TimeShiftable<PVCoordinates>, Serializable
a3
,
pv3
.
acceleration
,
a4
,
pv4
.
acceleration
);
}
/** Builds a PVCoordinates triplet from a {@link FieldVector3D}<{@link Derivative
Structure
}>.
/** Builds a PVCoordinates triplet from a {@link FieldVector3D}<{@link Derivative}>.
* <p>
* The vector components must have time as their only derivation parameter and
* have consistent derivation orders.
* </p>
* @param p vector with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
*/
public
PVCoordinates
(
final
FieldVector3D
<
DerivativeStructure
>
p
)
{
public
<
U
extends
Derivative
<
U
>>
PVCoordinates
(
final
FieldVector3D
<
U
>
p
)
{
position
=
new
Vector3D
(
p
.
getX
().
getReal
(),
p
.
getY
().
getReal
(),
p
.
getZ
().
getReal
());
if
(
p
.
getX
().
getOrder
()
>=
1
)
{
velocity
=
new
Vector3D
(
p
.
getX
().
getPartialDerivative
(
1
),
...
...
src/main/java/org/orekit/utils/TimeStampedAngularCoordinates.java
View file @
fe31ff66
...
...
@@ -18,7 +18,7 @@ package org.orekit.utils;
import
java.util.Collection
;
import
org.hipparchus.analysis.differentiation.Derivative
Structure
;
import
org.hipparchus.analysis.differentiation.Derivative
;
import
org.hipparchus.analysis.interpolation.HermiteInterpolator
;
import
org.hipparchus.geometry.euclidean.threed.FieldRotation
;
import
org.hipparchus.geometry.euclidean.threed.Rotation
;
...
...
@@ -108,16 +108,17 @@ public class TimeStampedAngularCoordinates extends AngularCoordinates implements
this
.
date
=
date
;
}
/** Builds a TimeStampedAngularCoordinates from a {@link FieldRotation}<{@link Derivative
Structure
}>.
/** Builds a TimeStampedAngularCoordinates from a {@link FieldRotation}<{@link Derivative}>.
* <p>
* The rotation components must have time as their only derivation parameter and
* have consistent derivation orders.
* </p>
* @param date coordinates date
* @param r rotation with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
*/
public
TimeStampedAngularCoordinates
(
final
AbsoluteDate
date
,
final
FieldRotation
<
DerivativeStructure
>
r
)
{
public
<
U
extends
Derivative
<
U
>>
TimeStampedAngularCoordinates
(
final
AbsoluteDate
date
,
final
FieldRotation
<
U
>
r
)
{
super
(
r
);
this
.
date
=
date
;
}
...
...
src/main/java/org/orekit/utils/TimeStampedFieldAngularCoordinates.java
View file @
fe31ff66
...
...
@@ -20,6 +20,7 @@ import java.util.Collection;
import
org.hipparchus.Field
;
import
org.hipparchus.RealFieldElement
;
import
org.hipparchus.analysis.differentiation.FieldDerivative
;
import
org.hipparchus.analysis.differentiation.FieldDerivativeStructure
;
import
org.hipparchus.analysis.interpolation.FieldHermiteInterpolator
;
import
org.hipparchus.geometry.euclidean.threed.FieldRotation
;
...
...
@@ -157,10 +158,11 @@ public class TimeStampedFieldAngularCoordinates<T extends RealFieldElement<T>>
* </p>
* @param date coordinates date
* @param r rotation with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
* @since 9.2
*/
public
TimeStampedFieldAngularCoordinates
(
final
FieldAbsoluteDate
<
T
>
date
,
final
FieldRotation
<
FieldDerivativeStructure
<
T
>
>
r
)
{
public
<
U
extends
FieldDerivative
<
T
,
U
>>
TimeStampedFieldAngularCoordinates
(
final
FieldAbsoluteDate
<
T
>
date
,
final
FieldRotation
<
U
>
r
)
{
super
(
r
);
this
.
date
=
date
;
}
...
...
src/main/java/org/orekit/utils/TimeStampedFieldPVCoordinates.java
View file @
fe31ff66
...
...
@@ -20,7 +20,7 @@ import java.util.Collection;
import
java.util.stream.Stream
;
import
org.hipparchus.RealFieldElement
;
import
org.hipparchus.analysis.differentiation.FieldDerivative
Structure
;
import
org.hipparchus.analysis.differentiation.FieldDerivative
;
import
org.hipparchus.analysis.interpolation.FieldHermiteInterpolator
;
import
org.hipparchus.geometry.euclidean.threed.FieldVector3D
;
import
org.orekit.annotation.DefaultDataContext
;
...
...
@@ -577,10 +577,11 @@ public class TimeStampedFieldPVCoordinates<T extends RealFieldElement<T>>
* have consistent derivation orders.
* </p>
* @param date date of the built coordinates
* @param <U> type of the derivative
* @param p vector with time-derivatives embedded within the coordinates
*/
public
TimeStampedFieldPVCoordinates
(
final
FieldAbsoluteDate
<
T
>
date
,
final
FieldVector3D
<
FieldDerivativeStructure
<
T
>
>
p
)
{
public
<
U
extends
FieldDerivative
<
T
,
U
>>
TimeStampedFieldPVCoordinates
(
final
FieldAbsoluteDate
<
T
>
date
,
final
FieldVector3D
<
U
>
p
)
{
super
(
p
);
this
.
date
=
date
;
}
...
...
src/main/java/org/orekit/utils/TimeStampedPVCoordinates.java
View file @
fe31ff66
...
...
@@ -20,7 +20,7 @@ import java.io.Serializable;
import
java.util.Collection
;
import
java.util.stream.Stream
;
import
org.hipparchus.analysis.differentiation.Derivative
Structure
;
import
org.hipparchus.analysis.differentiation.Derivative
;
import
org.hipparchus.analysis.interpolation.HermiteInterpolator
;
import
org.hipparchus.geometry.euclidean.threed.FieldVector3D
;
import
org.hipparchus.geometry.euclidean.threed.Vector3D
;
...
...
@@ -175,16 +175,16 @@ public class TimeStampedPVCoordinates extends PVCoordinates implements TimeStamp
this
.
date
=
date
;
}
/** Builds a TimeStampedPVCoordinates triplet from a {@link FieldVector3D}<{@link Derivative
Structure
}>.
/** Builds a TimeStampedPVCoordinates triplet from a {@link FieldVector3D}<{@link Derivative}>.
* <p>
* The vector components must have time as their only derivation parameter and
* have consistent derivation orders.
* </p>
* @param date date of the built coordinates
* @param p vector with time-derivatives embedded within the coordinates
* @param <U> type of the derivative
*/
public
TimeStampedPVCoordinates
(
final
AbsoluteDate
date
,
final
FieldVector3D
<
DerivativeStructure
>
p
)
{
public
<
U
extends
Derivative
<
U
>>
TimeStampedPVCoordinates
(
final
AbsoluteDate
date
,
final
FieldVector3D
<
U
>
p
)
{
super
(
p
);
this
.
date
=
date
;
}
...
...
src/test/java/org/orekit/utils/AbsolutePVCoordinatesTest.java
View file @
fe31ff66
...
...
@@ -28,6 +28,8 @@ import java.util.List;
import
java.util.Random
;
import
org.hipparchus.analysis.differentiation.DerivativeStructure
;
import
org.hipparchus.analysis.differentiation.UnivariateDerivative1
;
import
org.hipparchus.analysis.differentiation.UnivariateDerivative2
;
import
org.hipparchus.analysis.polynomials.PolynomialFunction
;
import
org.hipparchus.geometry.euclidean.threed.FieldVector3D
;
import
org.hipparchus.geometry.euclidean.threed.Vector3D
;
...
...
@@ -127,6 +129,50 @@ public class AbsolutePVCoordinatesTest {
1.0
e
-
15
);
}
@Test
public
void
testToDerivativeStructureVector1
()
{
FieldVector3D
<
DerivativeStructure
>
fv
=
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
new
Vector3D
(
1
,
0.1
,
10
),
new
Vector3D
(-
1
,
-
0.1
,
-
10
),
new
Vector3D
(
10
,
-
1.0
,
-
100
)).
toDerivativeStructureVector
(
1
);
Assert
.
assertEquals
(
1
,
fv
.
getX
().
getFreeParameters
());
Assert
.
assertEquals
(
1
,
fv
.
getX
().
getOrder
());
Assert
.
assertEquals
(
1.0
,
fv
.
getX
().
getReal
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.1
,
fv
.
getY
().
getReal
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
10.0
,
fv
.
getZ
().
getReal
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
-
1.0
,
fv
.
getX
().
getPartialDerivative
(
1
),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
0.1
,
fv
.
getY
().
getPartialDerivative
(
1
),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
10.0
,
fv
.
getZ
().
getPartialDerivative
(
1
),
1.0
e
-
15
);
checkPV
(
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
new
Vector3D
(
1
,
0.1
,
10
),
new
Vector3D
(-
1
,
-
0.1
,
-
10
),
Vector3D
.
ZERO
),
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
fv
),
1.0
e
-
15
);
for
(
double
dt
=
0
;
dt
<
10
;
dt
+=
0.125
)
{
Vector3D
p
=
new
PVCoordinates
(
new
Vector3D
(
1
,
0.1
,
10
),
new
Vector3D
(-
1
,
-
0.1
,
-
10
)).
shiftedBy
(
dt
).
getPosition
();
Assert
.
assertEquals
(
p
.
getX
(),
fv
.
getX
().
taylor
(
dt
),
1.0
e
-
14
);
Assert
.
assertEquals
(
p
.
getY
(),
fv
.
getY
().
taylor
(
dt
),
1.0
e
-
14
);
Assert
.
assertEquals
(
p
.
getZ
(),
fv
.
getZ
().
taylor
(
dt
),
1.0
e
-
14
);
}
AbsolutePVCoordinates
pv
=
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
fv
);
Assert
.
assertEquals
(
1.0
,
pv
.
getPosition
().
getX
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.1
,
pv
.
getPosition
().
getY
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
10.0
,
pv
.
getPosition
().
getZ
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
-
1.0
,
pv
.
getVelocity
().
getX
(),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
0.1
,
pv
.
getVelocity
().
getY
(),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
10.0
,
pv
.
getVelocity
().
getZ
(),
1.0
e
-
15
);
}
@Test
public
void
testToDerivativeStructureVector2
()
{
FieldVector3D
<
DerivativeStructure
>
fv
=
...
...
@@ -162,6 +208,115 @@ public class AbsolutePVCoordinatesTest {
Assert
.
assertEquals
(
p
.
getY
(),
fv
.
getY
().
taylor
(
dt
),
1.0
e
-
14
);
Assert
.
assertEquals
(
p
.
getZ
(),
fv
.
getZ
().
taylor
(
dt
),
1.0
e
-
14
);
}
AbsolutePVCoordinates
pv
=
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
fv
);
Assert
.
assertEquals
(
1.0
,
pv
.
getPosition
().
getX
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.1
,
pv
.
getPosition
().
getY
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
10.0
,
pv
.
getPosition
().
getZ
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
-
1.0
,
pv
.
getVelocity
().
getX
(),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
0.1
,
pv
.
getVelocity
().
getY
(),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
10.0
,
pv
.
getVelocity
().
getZ
(),
1.0
e
-
15
);
Assert
.
assertEquals
(
10.0
,
pv
.
getAcceleration
().
getX
(),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
1.0
,
pv
.
getAcceleration
().
getY
(),
1.0
e
-
15
);
Assert
.
assertEquals
(-
100.0
,
pv
.
getAcceleration
().
getZ
(),
1.0
e
-
15
);
}
@Test
public
void
testToUnivariateDerivative1Vector
()
{
FieldVector3D
<
UnivariateDerivative1
>
fv
=
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
new
Vector3D
(
1
,
0.1
,
10
),
new
Vector3D
(-
1
,
-
0.1
,
-
10
),
new
Vector3D
(
10
,
-
1.0
,
-
100
)).
toUnivariateDerivative1Vector
();
Assert
.
assertEquals
(
1
,
fv
.
getX
().
getFreeParameters
());
Assert
.
assertEquals
(
1
,
fv
.
getX
().
getOrder
());
Assert
.
assertEquals
(
1.0
,
fv
.
getX
().
getReal
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.1
,
fv
.
getY
().
getReal
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
10.0
,
fv
.
getZ
().
getReal
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
-
1.0
,
fv
.
getX
().
getPartialDerivative
(
1
),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
0.1
,
fv
.
getY
().
getPartialDerivative
(
1
),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
10.0
,
fv
.
getZ
().
getPartialDerivative
(
1
),
1.0
e
-
15
);
checkPV
(
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
new
Vector3D
(
1
,
0.1
,
10
),
new
Vector3D
(-
1
,
-
0.1
,
-
10
),
Vector3D
.
ZERO
),
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
fv
),
1.0
e
-
15
);
for
(
double
dt
=
0
;
dt
<
10
;
dt
+=
0.125
)
{
Vector3D
p
=
new
PVCoordinates
(
new
Vector3D
(
1
,
0.1
,
10
),
new
Vector3D
(-
1
,
-
0.1
,
-
10
)).
shiftedBy
(
dt
).
getPosition
();
Assert
.
assertEquals
(
p
.
getX
(),
fv
.
getX
().
taylor
(
dt
),
1.0
e
-
14
);
Assert
.
assertEquals
(
p
.
getY
(),
fv
.
getY
().
taylor
(
dt
),
1.0
e
-
14
);
Assert
.
assertEquals
(
p
.
getZ
(),
fv
.
getZ
().
taylor
(
dt
),
1.0
e
-
14
);
}
AbsolutePVCoordinates
pv
=
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
fv
);
Assert
.
assertEquals
(
1.0
,
pv
.
getPosition
().
getX
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.1
,
pv
.
getPosition
().
getY
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
10.0
,
pv
.
getPosition
().
getZ
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
-
1.0
,
pv
.
getVelocity
().
getX
(),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
0.1
,
pv
.
getVelocity
().
getY
(),
1.0
e
-
15
);
Assert
.
assertEquals
(
-
10.0
,
pv
.
getVelocity
().
getZ
(),
1.0
e
-
15
);
}
@Test
public
void
testToUnivariateDerivative2Vector
()
{
FieldVector3D
<
UnivariateDerivative2
>
fv
=
new
AbsolutePVCoordinates
(
FramesFactory
.
getEME2000
(),
AbsoluteDate
.
GALILEO_EPOCH
,
new
Vector3D
(
1
,
0.1
,
10
),
new
Vector3D
(-
1
,
-
0.1
,
-
10
),
new
Vector3D
(
10
,
-
1.0
,
-
100
)).
toUnivariateDerivative2Vector
();
Assert
.
assertEquals
(
1
,
fv
.
getX
().
getFreeParameters
());
Assert
.
assertEquals
(
2
,
fv
.
getX
().
getOrder
());
Assert
.
assertEquals
(
1.0
,
fv
.
getX
().
getReal
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
0.1
,
fv
.
getY
().
getReal
(),
1.0
e
-
10
);
Assert
.
assertEquals
(
10.0
,
fv
.
getZ
().
getReal
(),
1.0
e
-
10
);