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.bodies;
18  
19  import org.hipparchus.CalculusFieldElement;
20  import org.hipparchus.geometry.euclidean.threed.FieldLine;
21  import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
22  import org.hipparchus.geometry.euclidean.threed.Line;
23  import org.hipparchus.geometry.euclidean.threed.Vector3D;
24  import org.orekit.frames.Frame;
25  import org.orekit.time.AbsoluteDate;
26  import org.orekit.time.FieldAbsoluteDate;
27  import org.orekit.utils.TimeStampedPVCoordinates;
28  
29  
30  /** Interface representing the rigid surface shape of a natural body.
31   * <p>The shape is not provided as a single complete geometric
32   * model, but single points can be queried ({@link #getIntersectionPoint}).</p>
33   * @author Luc Maisonobe
34   */
35  public interface BodyShape {
36  
37      /** Get body frame related to body shape.
38       * @return body frame related to body shape
39       */
40      Frame getBodyFrame();
41  
42      /** Get the intersection point of a line with the surface of the body.
43       * <p>A line may have several intersection points with a closed
44       * surface (we consider the one point case as a degenerated two
45       * points case). The close parameter is used to select which of
46       * these points should be returned. The selected point is the one
47       * that is closest to the close point.</p>
48       * @param line test line (may intersect the body or not)
49       * @param close point used for intersections selection
50       * @param frame frame in which line is expressed
51       * @param date date of the line in given frame
52       * @return intersection point at altitude zero or null if the line does
53       * not intersect the surface
54       */
55      GeodeticPoint getIntersectionPoint(Line line, Vector3D close,
56                                         Frame frame, AbsoluteDate date);
57  
58      /** Get the intersection point of a line with the surface of the body.
59       * <p>A line may have several intersection points with a closed
60       * surface (we consider the one point case as a degenerated two
61       * points case). The close parameter is used to select which of
62       * these points should be returned. The selected point is the one
63       * that is closest to the close point.</p>
64       * @param line test line (may intersect the body or not)
65       * @param close point used for intersections selection
66       * @param frame frame in which line is expressed
67       * @param date date of the line in given frame
68       * @param <T> type of the field elements
69       * @return intersection point at altitude zero or null if the line does
70       * not intersect the surface
71       * @since 9.0
72       */
73      <T extends CalculusFieldElement<T>> FieldGeodeticPoint<T> getIntersectionPoint(FieldLine<T> line, FieldVector3D<T> close,
74                                                                                 Frame frame, FieldAbsoluteDate<T> date);
75  
76      /** Project a point to the ground.
77       * @param point point to project
78       * @param date current date
79       * @param frame frame in which moving point is expressed
80       * @return ground point exactly at the local vertical of specified point,
81       * in the same frame as specified point
82       * @see #projectToGround(TimeStampedPVCoordinates, Frame)
83       * @since 7.0
84       */
85      Vector3D projectToGround(Vector3D point, AbsoluteDate date, Frame frame);
86  
87      /** Project a moving point to the ground.
88       * @param pv moving point
89       * @param frame frame in which moving point is expressed
90       * @return ground point exactly at the local vertical of specified point,
91       * in the same frame as specified point
92       * @see #projectToGround(Vector3D, AbsoluteDate, Frame)
93       * @since 7.0
94       */
95      TimeStampedPVCoordinates projectToGround(TimeStampedPVCoordinates pv, Frame frame);
96  
97      /** Transform a Cartesian point to a surface-relative point.
98       * @param point Cartesian point
99       * @param frame frame in which Cartesian point is expressed
100      * @param date date of the computation (used for frames conversions)
101      * @return point at the same location but as a surface-relative point
102      */
103     GeodeticPoint transform(Vector3D point, Frame frame, AbsoluteDate date);
104 
105     /** Transform a Cartesian point to a surface-relative point.
106      * @param point Cartesian point
107      * @param <T> type of the filed elements
108      * @param frame frame in which Cartesian point is expressed
109      * @param date date of the computation (used for frames conversions)
110      * @return point at the same location but as a surface-relative point
111      * @since 9.0
112      */
113     <T extends CalculusFieldElement<T>> FieldGeodeticPoint<T> transform(FieldVector3D<T> point, Frame frame,
114                                                                     FieldAbsoluteDate<T> date);
115 
116     /** Transform a surface-relative point to a Cartesian point.
117      * @param point surface-relative point
118      * @return point at the same location but as a Cartesian point
119      */
120     Vector3D transform(GeodeticPoint point);
121 
122     /** Transform a surface-relative point to a Cartesian point.
123      * @param point surface-relative point
124      * @param <T> type of the filed elements
125      * @return point at the same location but as a Cartesian point
126      * @since 9.0
127      */
128     <T extends CalculusFieldElement<T>> FieldVector3D<T> transform(FieldGeodeticPoint<T> point);
129 
130 }