1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.orekit.files.ccsds.ndm.adm.apm;
19
20 import org.hipparchus.linear.MatrixUtils;
21 import org.hipparchus.linear.RealMatrix;
22 import org.orekit.files.ccsds.definitions.FrameFacade;
23 import org.orekit.files.ccsds.ndm.CommonPhysicalProperties;
24
25
26
27
28
29 public class Inertia extends CommonPhysicalProperties {
30
31
32 private FrameFacade frame;
33
34
35 private RealMatrix inertiaMatrix;
36
37
38
39 public Inertia() {
40 inertiaMatrix = MatrixUtils.createRealMatrix(new double[][] {
41 { Double.NaN, Double.NaN, Double.NaN },
42 { Double.NaN, Double.NaN, Double.NaN },
43 { Double.NaN, Double.NaN, Double.NaN }
44 });
45 }
46
47
48 @Override
49 public void validate(final double version) {
50 super.validate(version);
51 if (version >= 2.0) {
52 checkNotNull(frame, InertiaKey.INERTIA_REF_FRAME.name());
53 }
54 checkNotNaN(inertiaMatrix.getEntry(0, 0), InertiaKey.IXX.name());
55 checkNotNaN(inertiaMatrix.getEntry(1, 1), InertiaKey.IYY.name());
56 checkNotNaN(inertiaMatrix.getEntry(2, 2), InertiaKey.IZZ.name());
57 checkNotNaN(inertiaMatrix.getEntry(0, 1), InertiaKey.IXY.name());
58 checkNotNaN(inertiaMatrix.getEntry(0, 2), InertiaKey.IXZ.name());
59 checkNotNaN(inertiaMatrix.getEntry(1, 2), InertiaKey.IYZ.name());
60 }
61
62
63
64
65 public void setFrame(final FrameFacade frame) {
66 this.frame = frame;
67 }
68
69
70
71
72 public FrameFacade getFrame() {
73 return frame;
74 }
75
76
77
78
79 public RealMatrix getInertiaMatrix() {
80 return inertiaMatrix;
81 }
82
83
84
85
86
87
88
89
90
91 public void setInertiaMatrixEntry(final int j, final int k, final double entry) {
92 refuseFurtherComments();
93 inertiaMatrix.setEntry(j, k, entry);
94 inertiaMatrix.setEntry(k, j, entry);
95 }
96
97 }