1   /* Copyright 2024-2026 Rafael Ayala
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.control.heuristics.lambert;
18  
19  import org.hipparchus.geometry.euclidean.threed.Vector3D;
20  import org.orekit.annotation.DefaultDataContext;
21  
22  /**
23   * Class holding a solution to the Lambert problem.
24   *
25   * @author Rafael Ayala
26   * @since 14.0
27   */
28  public class LambertSolution {
29  
30      /** number of complete revolutions. */
31      private final int nRev;
32  
33      /** path (high or low). */
34      private final LambertPathType pathType;
35  
36      /** orbit type (elliptic, parabolic, etc). */
37      private final LambertOrbitType orbitType;
38  
39      /** posigrade flag (true for prograde orbits, false for retrograde orbits). */
40      private final boolean posigrade;
41  
42      /** LambertBoundaryConditions with the boundary conditions for the Lambert problem. */
43      private final LambertBoundaryConditions boundaryConditions;
44  
45      /** LambertBoundaryVelocities holding the initial and terminal velocities. */
46      private final LambertBoundaryVelocities boundaryVelocities;
47  
48      /**
49       * Basic constructor with initial and terminal velocities.
50       * @param nRev number of complete revolutions
51       * @param pathType path (high or low)
52       * @param orbitType orbit type (elliptic, parabolic, etc)
53       * @param posigrade posigrade flag (true for prograde orbits, false for retrograde orbits)
54       * @param boundaryConditions LambertBoundaryConditions with the boundary conditions for the Lambert problem
55       * @param v1 velocity at t1 (initial velocity)
56       * @param v2 velocity at t2 (terminal velocity)
57       */
58      public LambertSolution(final int nRev, final LambertPathType pathType, final LambertOrbitType orbitType, final boolean posigrade,
59                          final LambertBoundaryConditions boundaryConditions, final Vector3D v1, final Vector3D v2) {
60          this.nRev = nRev;
61          this.pathType = pathType;
62          this.orbitType = orbitType;
63          this.posigrade = posigrade;
64          this.boundaryConditions = boundaryConditions;
65          this.boundaryVelocities = new LambertBoundaryVelocities(v1, v2);
66      }
67  
68      /**
69       * Basic constructor with LambertBoundaryVelocities directly.
70       * @param nRev number of complete revolutions
71       * @param pathType path (high or low)
72       * @param orbitType orbit type (elliptic, parabolic, etc)
73       * @param posigrade posigrade flag (true for prograde orbits, false for retrograde orbits)
74       * @param boundaryConditions LambertBoundaryConditions with the boundary conditions for the Lambert problem
75       * @param boundaryVelocities LambertBoundaryVelocities with initial and terminal velocities
76       */
77      public LambertSolution(final int nRev, final LambertPathType pathType, final LambertOrbitType orbitType, final boolean posigrade,
78                          final LambertBoundaryConditions boundaryConditions, final LambertBoundaryVelocities boundaryVelocities) {
79          this.nRev = nRev;
80          this.pathType = pathType;
81          this.orbitType = orbitType;
82          this.posigrade = posigrade;
83          this.boundaryConditions = boundaryConditions;
84          this.boundaryVelocities = boundaryVelocities;
85      }
86  
87      /**
88       * Get the number of complete revolutions.
89       * @return number of complete revolutions
90       */
91      public int getNRev() {
92          return nRev;
93      }
94  
95      /**
96       * Get the path type (high or low).
97       * @return path type
98       */
99      public LambertPathType getPathType() {
100         return pathType;
101     }
102 
103     /**
104      * Get the orbit type (elliptic, parabolic, hyperbolic).
105      * @return orbit type
106      */
107     public LambertOrbitType getOrbitType() {
108         return orbitType;
109     }
110 
111     /**
112      * Get the posigrade flag.
113      * @return posigrade flag
114      */
115     public boolean getPosigrade() {
116         return posigrade;
117     }
118 
119     /**
120      * Get the boundary conditions.
121      * @return boundary conditions
122      */
123     public LambertBoundaryConditions getBoundaryConditions() {
124         return boundaryConditions;
125     }
126 
127     /**
128      * Get the boundary velocities.
129      * @return boundary velocities
130      */
131     public LambertBoundaryVelocities getBoundaryVelocities() {
132         return boundaryVelocities;
133     }
134 
135     /** {@inheritDoc} */
136     @Override
137     @DefaultDataContext
138     public String toString() {
139         return "LambertSolution{" +
140                 "nRev=" + nRev +
141                 ", pathType=" + pathType +
142                 ", orbitType=" + orbitType +
143                 ", posigrade=" + posigrade +
144                 ", boundaryConditions=" + boundaryConditions +
145                 ", boundaryVelocities=" + boundaryVelocities +
146                 "}";
147     }
148 
149 }