HaloXZPlaneCrossingDetector.java

  1. /* Copyright 2002-2024 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.propagation.events;

  18. import org.orekit.propagation.SpacecraftState;
  19. import org.orekit.propagation.events.handlers.EventHandler;
  20. import org.orekit.propagation.events.handlers.StopOnIncreasing;

  21. /** Detector for XZ Plane crossing.
  22.  * @author Vincent Mouraux
  23.  * @since 10.2
  24.  */
  25. public class HaloXZPlaneCrossingDetector extends AbstractDetector<HaloXZPlaneCrossingDetector> {

  26.     /**
  27.      * Simple Constructor.
  28.      * @param maxCheck maximum checking interval (s)
  29.      * @param threshold convergence threshold (s)
  30.      */
  31.     public HaloXZPlaneCrossingDetector(final double maxCheck, final double threshold) {
  32.         this(AdaptableInterval.of(maxCheck), threshold, DEFAULT_MAX_ITER,
  33.              new StopOnIncreasing());
  34.     }

  35.     /**
  36.      * Protected constructor with full parameters.
  37.      * <p>
  38.      * This constructor is not public as users are expected to use the builder API
  39.      * with the various {@code withXxx()} methods to set up the instance in a
  40.      * readable manner without using a huge amount of parameters.
  41.      * </p>
  42.      * @param maxCheck maximum checking interval
  43.      * @param threshold convergence threshold (s)
  44.      * @param maxIter maximum number of iterations in the event time search
  45.      * @param handler event handler to call at event occurrences
  46.      */
  47.     protected HaloXZPlaneCrossingDetector(final AdaptableInterval maxCheck, final double threshold,
  48.                                           final int maxIter,
  49.                                           final EventHandler handler) {
  50.         super(maxCheck, threshold, maxIter, handler);
  51.     }

  52.     /** {@inheritDoc} */
  53.     @Override
  54.     protected HaloXZPlaneCrossingDetector create(final AdaptableInterval newMaxCheck, final double newThreshold,
  55.                                                  final int newMaxIter,
  56.                                                  final EventHandler newHandler) {
  57.         return new HaloXZPlaneCrossingDetector(newMaxCheck, newThreshold, newMaxIter, newHandler);
  58.     }

  59.     /** Compute the value of the detection function.
  60.      * @param s the current state information: date, kinematics, attitude
  61.      * @return Position on Y axis
  62.      */
  63.     public double g(final SpacecraftState s) {
  64.         return s.getPosition().getY();
  65.     }

  66. }