1 /* Contributed in the public domain.
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.orekit.frames;
18
19 import org.hipparchus.CalculusFieldElement;
20 import org.hipparchus.geometry.euclidean.threed.FieldRotation;
21 import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
22 import org.hipparchus.geometry.euclidean.threed.RotationConvention;
23 import org.orekit.annotation.DefaultDataContext;
24 import org.orekit.data.DataContext;
25 import org.orekit.time.FieldAbsoluteDate;
26 import org.orekit.time.TimeScalarFunction;
27 import org.orekit.time.TimeScales;
28 import org.orekit.utils.IERSConventions;
29
30 /**
31 * An inertial frame aligned with the ecliptic.
32 * <p>
33 * The IAU defines the ecliptic as "the plane perpendicular to the mean heliocentric
34 * orbital angular momentum vector of the Earth-Moon barycentre in the BCRS (IAU 2006
35 * Resolution B1)." The +z axis is aligned with the angular momentum vector, and the +x
36 * axis is aligned with +x axis of {@link Frames#getMOD(IERSConventions) MOD}.
37 * </p>
38 *
39 * <p>
40 * This implementation agrees with the JPL 406 ephemerides to within 0.5 arc seconds.
41 * </p>
42 *
43 * @since 7.0
44 */
45 public class EclipticProvider implements FieldBasedTransformProvider {
46
47 /** the obliquity of the ecliptic, in radians as a function of time. */
48 private final TimeScalarFunction obliquity;
49
50 /**
51 * Create a transform provider from MOD to an ecliptically aligned frame.
52 *
53 * <p>This constructor uses the {@link DataContext#getDefault() default data context}.
54 *
55 * @param conventions IERS conventions
56 * @see #EclipticProvider(IERSConventions, TimeScales)
57 */
58 @DefaultDataContext
59 public EclipticProvider(final IERSConventions conventions) {
60 this(conventions, DataContext.getDefault().getTimeScales());
61 }
62
63 /**
64 * Create a transform provider from MOD to an ecliptically aligned frame.
65 * @param conventions IERS conventions
66 * @param timeScales to use in computing the transformation.
67 * @since 10.1
68 */
69 public EclipticProvider(final IERSConventions conventions,
70 final TimeScales timeScales) {
71 this.obliquity = conventions.getMeanObliquityFunction(timeScales);
72 }
73
74 /** Compute the ecliptic rotation.
75 * @param date current date
76 * @param <T> type of the field elements
77 * @return ecliptic rotation
78 */
79 public <T extends CalculusFieldElement<T>> FieldRotation<T> getRotation(final FieldAbsoluteDate<T> date) {
80 //mean obliquity of date
81 final T epsA = obliquity.value(date);
82 return new FieldRotation<>(FieldVector3D.getMinusI(date.getField()), epsA,
83 RotationConvention.VECTOR_OPERATOR);
84 }
85
86 }