CR3BPFactory.java

  1. /* Copyright 2002-2025 CS GROUP
  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.bodies;

  18. import org.orekit.annotation.DefaultDataContext;
  19. import org.orekit.propagation.numerical.cr3bp.CR3BPConstants;
  20. import org.orekit.time.AbsoluteDate;
  21. import org.orekit.time.TimeScale;

  22. /**
  23.  * Factory class creating predefined CR3BP system using CR3BPSystem class. For example, Earth-Moon CR3BP
  24.  * System.
  25.  * @author Vincent Mouraux
  26.  * @see CR3BPSystem
  27.  * @since 10.2
  28.  */
  29. public class CR3BPFactory {

  30.     /** Private constructor.
  31.      * <p>This class is a utility class, it should neither have a public
  32.      * nor a default constructor. This private constructor prevents
  33.      * the compiler from generating one automatically.</p>
  34.      */
  35.     private CR3BPFactory() {
  36.     }

  37.     /** Get the Sun-Jupiter CR3BP singleton bodies pair.
  38.      * @param date date
  39.      * @param timeScale time scale
  40.      * @return Sun-Jupiter CR3BP system
  41.      */
  42.     @DefaultDataContext
  43.     public static CR3BPSystem getSunJupiterCR3BP(final AbsoluteDate date, final TimeScale timeScale) {
  44.         return getSystem(CelestialBodyFactory.getSun(), CelestialBodyFactory.getJupiter(), CR3BPConstants.getJupiterSemiMajorAxis(date, timeScale));
  45.     }

  46.     /** Get the Sun-Earth CR3BP singleton bodies pair.
  47.      * @param date date
  48.      * @param timeScale time scale
  49.      * @return Sun-Earth CR3BP system
  50.      */
  51.     @DefaultDataContext
  52.     public static CR3BPSystem getSunEarthCR3BP(final AbsoluteDate date, final TimeScale timeScale) {
  53.         return getSystem(CelestialBodyFactory.getSun(), CelestialBodyFactory.getEarthMoonBarycenter(), CR3BPConstants.getEarthMoonBarycenterSemiMajorAxis(date, timeScale));
  54.     }

  55.     /** Get the Earth-Moon CR3BP singleton bodies pair.
  56.      * @return Earth-Moon CR3BP system
  57.      */
  58.     @DefaultDataContext
  59.     public static CR3BPSystem getEarthMoonCR3BP() {
  60.         return getSystem(CelestialBodyFactory.getEarth(), CelestialBodyFactory.getMoon(), CR3BPConstants.getMoonSemiMajorAxis());
  61.     }

  62.     /** Get the corresponding CR3BP System.
  63.      * @param primaryBody Primary Body in the CR3BP System
  64.      * @param secondaryBody Secondary Body in the CR3BP System
  65.      * @param a Semi-Major Axis of the secondary body
  66.      * @return corresponding CR3BP System
  67.      */
  68.     public static CR3BPSystem getSystem(final CelestialBody primaryBody, final CelestialBody secondaryBody, final double a) {
  69.         return new CR3BPSystem(primaryBody, secondaryBody, a);
  70.     }
  71. }