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.ssa.collision.shorttermencounter.probability.twod;
18  
19  import org.hipparchus.CalculusFieldElement;
20  import org.hipparchus.util.FastMath;
21  
22  /**
23   * Compute the probability of collision using the method described in : "Kyle Alfriend, Maruthi Akella, Joseph Frisbee, James
24   * Foster, Deok-Jin Lee, and Matthew Wilkins. Probability of ProbabilityOfCollision Error Analysis. Space Debris, 1(1):21–35,
25   * 1999.".
26   * <p>It assumes :
27   *     <ul>
28   *         <li>Short encounter leading to a linear relative motion.</li>
29   *         <li>Spherical collision object.</li>
30   *         <li>Uncorrelated positional covariance.</li>
31   *         <li>Gaussian distribution of the position uncertainties.</li>
32   *         <li>Deterministic velocity i.e. no velocity uncertainties.</li>
33   *         <li>Both objects are in circular orbits (eq 14).</li>
34   *         <li>Probability density function is constant over the collision disk (eq 18).</li>
35   *     </ul>
36   * <p>
37   * By assuming a constant probability density function over the collision circle this method will,
38   * <b>most of the time</b>, give much higher probability of collision than other regular methods.
39   * That is why it is qualified as a maximum probability of collision computing method.</p>
40   *
41   * @author Vincent Cucchietti
42   * @since 12.0
43   */
44  public class Alfriend1999 extends AbstractAlfriend1999 {
45  
46      /** Empty constructor. */
47      public Alfriend1999() {
48          super(ShortTermEncounter2DPOCMethodType.ALFRIEND_1999.name());
49      }
50  
51      /** {@inheritDoc} */
52      @Override
53      public boolean isAMaximumProbabilityOfCollisionMethod() {
54          return true;
55      }
56  
57      /** {@inheritDoc} */
58      @Override
59      public ShortTermEncounter2DPOCMethodType getType() {
60          return ShortTermEncounter2DPOCMethodType.ALFRIEND_1999;
61      }
62  
63      /** {@inheritDoc} */
64      @Override
65      double computeValue(final double radius, final double squaredMahalanobisDistance,
66                          final double covarianceMatrixDeterminant) {
67          return FastMath.exp(-0.5 * squaredMahalanobisDistance) * radius * radius /
68                  (2 * FastMath.sqrt(covarianceMatrixDeterminant));
69      }
70  
71      /** {@inheritDoc} */
72      @Override
73      <T extends CalculusFieldElement<T>> T computeValue(final T radius, final T squaredMahalanobisDistance,
74                                                         final T covarianceMatrixDeterminant) {
75          return squaredMahalanobisDistance.multiply(-0.5).exp().multiply(radius.square())
76                                           .divide(covarianceMatrixDeterminant.sqrt().multiply(2.));
77      }
78  
79  }