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
19 import org.orekit.propagation.SpacecraftState;
20 import org.orekit.propagation.events.handlers.EventHandler;
21 import org.orekit.propagation.events.handlers.StopOnIncreasing;
22
23 /** Detector for XZ Plane crossing.
24 * @author Vincent Mouraux
25 * @since 10.2
26 */
27 public class HaloXZPlaneCrossingDetector extends AbstractDetector<HaloXZPlaneCrossingDetector> {
28
29 /**
30 * Simple Constructor.
31 * @param maxCheck maximum checking interval (s)
32 * @param threshold convergence threshold (s)
33 */
34 public HaloXZPlaneCrossingDetector(final double maxCheck, final double threshold) {
35 this(AdaptableInterval.of(maxCheck), threshold, DEFAULT_MAX_ITER,
36 new StopOnIncreasing());
37 }
38
39 /**
40 * Protected constructor with full parameters.
41 * <p>
42 * This constructor is not public as users are expected to use the builder API
43 * with the various {@code withXxx()} methods to set up the instance in a
44 * readable manner without using a huge amount of parameters.
45 * </p>
46 * @param maxCheck maximum checking interval
47 * @param threshold convergence threshold (s)
48 * @param maxIter maximum number of iterations in the event time search
49 * @param handler event handler to call at event occurrences
50 */
51 protected HaloXZPlaneCrossingDetector(final AdaptableInterval maxCheck, final double threshold,
52 final int maxIter,
53 final EventHandler handler) {
54 super(maxCheck, threshold, maxIter, handler);
55 }
56
57 /** {@inheritDoc} */
58 @Override
59 protected HaloXZPlaneCrossingDetector create(final AdaptableInterval newMaxCheck, final double newThreshold,
60 final int newMaxIter,
61 final EventHandler newHandler) {
62 return new HaloXZPlaneCrossingDetector(newMaxCheck, newThreshold, newMaxIter, newHandler);
63 }
64
65 /** Compute the value of the detection function.
66 * @param s the current state information: date, kinematics, attitude
67 * @return Position on Y axis
68 */
69 public double g(final SpacecraftState s) {
70 return s.getPosition().getY();
71 }
72
73 }