1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.orbits;
18
19 import org.orekit.errors.OrekitIllegalArgumentException;
20 import org.orekit.errors.OrekitMessages;
21 import org.orekit.frames.Frame;
22 import org.orekit.time.AbsoluteDate;
23 import org.orekit.time.AbstractTimeInterpolator;
24
25 import java.util.ArrayList;
26 import java.util.Collection;
27 import java.util.List;
28
29
30
31
32
33
34 public abstract class AbstractOrbitInterpolator extends AbstractTimeInterpolator<Orbit> {
35
36
37 private final Frame outputInertialFrame;
38
39
40
41
42
43
44
45
46 public AbstractOrbitInterpolator(final int interpolationPoints, final double extrapolationThreshold,
47 final Frame outputInertialFrame) {
48 super(interpolationPoints, extrapolationThreshold);
49 checkFrameIsInertial(outputInertialFrame);
50 this.outputInertialFrame = outputInertialFrame;
51 }
52
53
54
55
56
57
58 public static void checkOrbitsConsistency(final Collection<Orbit> sample) {
59
60 final List<Orbit> sampleList = new ArrayList<>(sample);
61
62
63 for (int i = 0; i < sampleList.size() - 1; i++) {
64 final Orbit currentOrbit = sampleList.get(i);
65 final Orbit nextOrbit = sampleList.get(i + 1);
66
67 if (currentOrbit.getMu() != nextOrbit.getMu()) {
68 throw new OrekitIllegalArgumentException(OrekitMessages.ORBITS_MUS_MISMATCH, currentOrbit.getMu(),
69 nextOrbit.getMu());
70 }
71 }
72 }
73
74
75 @Override
76 public Orbit interpolate(final AbsoluteDate interpolationDate, final Collection<Orbit> sample) {
77
78
79 checkOrbitsConsistency(sample);
80
81 return super.interpolate(interpolationDate, sample);
82 }
83
84
85
86
87 public Frame getOutputInertialFrame() {
88 return outputInertialFrame;
89 }
90
91
92
93
94
95
96
97
98 private void checkFrameIsInertial(final Frame frame) {
99 if (!frame.isPseudoInertial()) {
100 throw new OrekitIllegalArgumentException(OrekitMessages.NON_PSEUDO_INERTIAL_FRAME, frame.getName());
101 }
102 }
103 }