HaloXZPlaneCrossingDetector.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.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(new EventDetectionSettings(maxCheck, threshold, DEFAULT_MAX_ITER), new StopOnIncreasing());
  33.     }

  34.     /**
  35.      * Protected constructor with full parameters.
  36.      * <p>
  37.      * This constructor is not public as users are expected to use the builder API
  38.      * with the various {@code withXxx()} methods to set up the instance in a
  39.      * readable manner without using a huge amount of parameters.
  40.      * </p>
  41.      * @param detectionSettings event detection settings
  42.      * @param handler event handler to call at event occurrences
  43.      * @since 13.0
  44.      */
  45.     protected HaloXZPlaneCrossingDetector(final EventDetectionSettings detectionSettings,
  46.                                           final EventHandler handler) {
  47.         super(detectionSettings, handler);
  48.     }

  49.     /** {@inheritDoc} */
  50.     @Override
  51.     protected HaloXZPlaneCrossingDetector create(final EventDetectionSettings detectionSettings,
  52.                                                  final EventHandler newHandler) {
  53.         return new HaloXZPlaneCrossingDetector(detectionSettings, newHandler);
  54.     }

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

  62. }