1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.models.earth.atmosphere;
18
19 import java.io.Serializable;
20
21 import org.hipparchus.CalculusFieldElement;
22 import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
23 import org.hipparchus.geometry.euclidean.threed.Vector3D;
24 import org.orekit.frames.FieldKinematicTransform;
25 import org.orekit.frames.Frame;
26 import org.orekit.frames.KinematicTransform;
27 import org.orekit.time.AbsoluteDate;
28 import org.orekit.time.FieldAbsoluteDate;
29 import org.orekit.utils.FieldPVCoordinates;
30 import org.orekit.utils.PVCoordinates;
31
32
33
34
35
36 public interface Atmosphere extends Serializable {
37
38
39
40
41
42 Frame getFrame();
43
44
45
46
47
48
49
50 double getDensity(AbsoluteDate date, Vector3D position, Frame frame);
51
52
53
54
55
56
57
58
59 <T extends CalculusFieldElement<T>> T getDensity(FieldAbsoluteDate<T> date, FieldVector3D<T> position, Frame frame);
60
61
62
63
64
65
66
67
68
69
70 default Vector3D getVelocity(AbsoluteDate date, Vector3D position, Frame frame) {
71 final KinematicTransform bodyToFrame = getFrame().getKinematicTransformTo(frame, date);
72 final Vector3D posInBody = bodyToFrame.getStaticInverse().transformPosition(position);
73 final PVCoordinates pvBody = new PVCoordinates(posInBody, Vector3D.ZERO);
74 final PVCoordinates pvFrame = bodyToFrame.transformOnlyPV(pvBody);
75 return pvFrame.getVelocity();
76 }
77
78
79
80
81
82
83
84
85 default <T extends CalculusFieldElement<T>> FieldVector3D<T> getVelocity(FieldAbsoluteDate<T> date,
86 FieldVector3D<T> position,
87 Frame frame) {
88 final FieldKinematicTransform<T> bodyToFrame = getFrame().getKinematicTransformTo(frame, date);
89 final FieldVector3D<T> posInBody = bodyToFrame.getStaticInverse().transformPosition(position);
90 final FieldPVCoordinates<T> pvBody = new FieldPVCoordinates<>(posInBody,
91 FieldVector3D.getZero(date.getField()));
92 final FieldPVCoordinates<T> pvFrame = bodyToFrame.transformOnlyPV(pvBody);
93 return pvFrame.getVelocity();
94 }
95
96 }