Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Orekit
Orekit
Commits
6bd47f2b
Commit
6bd47f2b
authored
Jul 20, 2022
by
Pascal Parraud
Browse files
Clean up Javadoc.
parent
42bb5f73
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/orekit/bodies/Loxodrome.java
View file @
6bd47f2b
...
...
@@ -21,12 +21,14 @@ import org.hipparchus.util.MathUtils;
/** Perform calculations on a loxodrome (commonly, a rhumb line) on an ellipsoid.
* <p>
* A <a href="https://en.wikipedia.org/wiki/Rhumb_line">loxodrome or rhumb line</a>
is an arc on an
* ellipsoid's surfa
n
ce that intersects every meridian at the same angle.
* A <a href="https://en.wikipedia.org/wiki/Rhumb_line">loxodrome or rhumb line</a>
*
is an arc on an
ellipsoid's surface that intersects every meridian at the same angle.
*
* @author Joe Reed
* @since 11.3
*/
public
class
Loxodrome
{
/** Threshold for cos angles being equal. */
private
static
final
double
COS_ANGLE_THRESHOLD
=
1
e
-
6
;
...
...
@@ -35,10 +37,13 @@ public class Loxodrome {
/** Reference point for the loxodrome. */
private
final
GeodeticPoint
point
;
/** Azimuth-off-north angle of the loxodrome. */
private
final
double
azimuth
;
/** Reference body. */
private
final
OneAxisEllipsoid
body
;
/** Altitude above the body. */
private
final
double
altitude
;
...
...
@@ -47,7 +52,7 @@ public class Loxodrome {
* This method is an equivalent to {@code new Loxodrome(point, azimuth, body, point.getAltitude())}
*
* @param point the initial loxodrome point
* @param azimuth the heading, clockwise angle from north (radians, {@code [0,2pi
)
})
* @param azimuth the heading, clockwise angle from north (radians, {@code [0,2pi
]
})
* @param body ellipsoid body on which the loxodrome is defined
*/
public
Loxodrome
(
final
GeodeticPoint
point
,
final
double
azimuth
,
final
OneAxisEllipsoid
body
)
{
...
...
@@ -57,40 +62,40 @@ public class Loxodrome {
/** Constructor building a loxodrome from an initial point and an azimuth-off-local-north heading.
*
* @param point the initial loxodrome point
* @param azimuth the heading, clockwise angle from north (radians, {@code [0,2pi
)
})
* @param azimuth the heading, clockwise angle from north (radians, {@code [0,2pi
]
})
* @param body ellipsoid body on which the loxodrome is defined
* @param altitude altitude above the reference body
*/
public
Loxodrome
(
final
GeodeticPoint
point
,
final
double
azimuth
,
final
OneAxisEllipsoid
body
,
final
double
altitude
)
{
this
.
point
=
point
;
this
.
azimuth
=
azimuth
;
this
.
body
=
body
;
final
double
altitude
)
{
this
.
point
=
point
;
this
.
azimuth
=
azimuth
;
this
.
body
=
body
;
this
.
altitude
=
altitude
;
}
/**
/**
Get the geodetic point defining the loxodrome.
* @return the geodetic point defining the loxodrome
*/
public
GeodeticPoint
getPoint
()
{
return
this
.
point
;
}
/**
/**
Get the azimuth.
* @return the azimuth
*/
public
double
getAzimuth
()
{
return
this
.
azimuth
;
}
/**
/**
Get the body on which the loxodrome is defined.
* @return the body on which the loxodrome is defined
*/
public
OneAxisEllipsoid
getBody
()
{
return
this
.
body
;
}
/**
/**
Get the altitude above the reference body.
* @return the altitude above the reference body
*/
public
double
getAltitude
()
{
...
...
@@ -100,7 +105,7 @@ public class Loxodrome {
/** Calculate the point at the specified distance from the origin point along the loxodrome.
*
* A positive distance follows the line in the azumuth direction (i.e. northward for arcs with azimuth
* angles {@code
(
3pi/2, 2pi
)
} or {@code [0, pi/2
)
}). Negative distances travel in the opposite direction along
* angles {@code
[
3pi/2, 2pi
]
} or {@code [0, pi/2
]
}). Negative distances travel in the opposite direction along
* the rhumb line.
*
* Distance is computed at the altitude of the origin point.
...
...
@@ -114,11 +119,11 @@ public class Loxodrome {
}
// compute the e sin(lat)^2
final
double
sinLat
=
FastMath
.
sin
(
getP
oint
()
.
getLatitude
());
final
double
eccSinLatSq
=
getB
ody
()
.
getEccentricitySquared
()
*
sinLat
*
sinLat
;
final
double
sinLat
=
FastMath
.
sin
(
p
oint
.
getLatitude
());
final
double
eccSinLatSq
=
b
ody
.
getEccentricitySquared
()
*
sinLat
*
sinLat
;
// compute intermediate values
final
double
t1
=
1
.
-
getB
ody
()
.
getEccentricitySquared
();
final
double
t1
=
1
.
-
b
ody
.
getEccentricitySquared
();
final
double
t2
=
1
.
-
eccSinLatSq
;
final
double
t3
=
FastMath
.
sqrt
(
t2
);
...
...
src/main/java/org/orekit/bodies/LoxodromeArc.java
View file @
6bd47f2b
...
...
@@ -20,17 +20,24 @@ import org.hipparchus.util.FastMath;
import
org.hipparchus.util.MathUtils
;
/** Loxodrome defined by a start and ending point.
*
* @author Joe Reed
* @since 11.3
*/
public
class
LoxodromeArc
extends
Loxodrome
{
/** Threshold for considering latitudes equal, in radians. */
private
static
final
double
LATITUDE_THRESHOLD
=
1
e
-
6
;
/** Maximum number of iterations used when computing distance between points. */
private
static
final
int
MAX_ITER
=
50
;
/** Ending point of the arc. */
private
final
GeodeticPoint
endPoint
;
/** Delta longitude, cached, radians. */
private
final
double
deltaLon
;
/** Cached arc distance, meters. */
private
double
distance
=
-
1
;
...
...
@@ -49,14 +56,16 @@ public class LoxodromeArc extends Loxodrome {
* @param body the body on which the loxodrome is defined
* @param altitude the altitude above the reference body (meters)
*/
public
LoxodromeArc
(
final
GeodeticPoint
point
,
final
GeodeticPoint
endPoint
,
final
OneAxisEllipsoid
body
,
final
double
altitude
)
{
public
LoxodromeArc
(
final
GeodeticPoint
point
,
final
GeodeticPoint
endPoint
,
final
OneAxisEllipsoid
body
,
final
double
altitude
)
{
super
(
point
,
body
.
azimuthBetweenPoints
(
point
,
endPoint
),
body
,
altitude
);
this
.
endPoint
=
endPoint
;
deltaLon
=
MathUtils
.
normalizeAngle
(
endPoint
.
getLongitude
(),
point
.
getLongitude
())
-
point
.
getLongitude
();
this
.
deltaLon
=
MathUtils
.
normalizeAngle
(
endPoint
.
getLongitude
(),
point
.
getLongitude
())
-
point
.
getLongitude
();
}
/** The final point of the arc.
/** Get the final point of the arc.
*
* @return the ending point of the arc
*/
public
GeodeticPoint
getFinalPoint
()
{
...
...
@@ -73,7 +82,8 @@ public class LoxodromeArc extends Loxodrome {
}
// compute the e sin(lat)^2
final
double
sinLat
=
FastMath
.
sin
(
getPoint
().
getLatitude
());
final
double
ptLat
=
getPoint
().
getLatitude
();
final
double
sinLat
=
FastMath
.
sin
(
ptLat
);
final
double
eccSinLatSq
=
getBody
().
getEccentricitySquared
()
*
sinLat
*
sinLat
;
// compute intermediate values
...
...
@@ -85,8 +95,8 @@ public class LoxodromeArc extends Loxodrome {
final
double
meridianCurve
=
(
semiMajorAxis
*
t1
)
/
(
t2
*
t3
);
if
(
FastMath
.
abs
(
endPoint
.
getLatitude
()
-
getPoint
().
getLatitude
()
)
<
LATITUDE_THRESHOLD
)
{
distance
=
(
semiMajorAxis
/
t3
)
*
FastMath
.
abs
(
FastMath
.
cos
(
getPoint
().
getLatitude
()
)
*
deltaLon
);
if
(
FastMath
.
abs
(
endPoint
.
getLatitude
()
-
ptLat
)
<
LATITUDE_THRESHOLD
)
{
distance
=
(
semiMajorAxis
/
t3
)
*
FastMath
.
abs
(
FastMath
.
cos
(
ptLat
)
*
deltaLon
);
}
else
{
final
double
eccSq34
=
0.75
*
getBody
().
getEccentricitySquared
();
...
...
@@ -94,8 +104,8 @@ public class LoxodromeArc extends Loxodrome {
final
double
t6
=
1
.
/
(
1
.
-
eccSq34
);
final
double
t7
=
t1
*
semiMajorAxis
/
meridianCurve
;
final
double
t8
=
getPoint
().
getLatitude
()
+
t6
*
(
t7
*
(
endPoint
.
getLatitude
()
-
getPoint
().
getLatitude
()
)
+
halfEccSq34
*
FastMath
.
sin
(
getPoint
().
getLatitude
()
*
2
.));
final
double
t8
=
ptLat
+
t6
*
(
t7
*
(
endPoint
.
getLatitude
()
-
ptLat
)
+
halfEccSq34
*
FastMath
.
sin
(
ptLat
*
2
.));
final
double
t9
=
halfEccSq34
*
t6
;
double
guess
=
0
;
...
...
@@ -110,8 +120,8 @@ public class LoxodromeArc extends Loxodrome {
}
final
double
azimuth
=
FastMath
.
atan2
(
deltaLon
,
getBody
().
geodeticToIsometricLatitude
(
lat
)
-
getBody
().
geodeticToIsometricLatitude
(
getPoint
().
getLatitude
()
));
distance
=
meridianCurve
*
FastMath
.
abs
((
lat
-
getPoint
().
getLatitude
()
)
/
FastMath
.
cos
(
azimuth
));
getBody
().
geodeticToIsometricLatitude
(
lat
)
-
getBody
().
geodeticToIsometricLatitude
(
ptLat
));
distance
=
meridianCurve
*
FastMath
.
abs
((
lat
-
ptLat
)
/
FastMath
.
cos
(
azimuth
));
}
return
distance
;
...
...
src/main/java/org/orekit/bodies/OneAxisEllipsoid.java
View file @
6bd47f2b
...
...
@@ -74,13 +74,13 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape {
/** Eccentricity. */
private
final
double
e
;
/** Eccentricity
power 2
. */
/** Eccentricity
squared
. */
private
final
double
e2
;
/** 1 minus flatness. */
private
final
double
g
;
/** g
* g
. */
/** g
squared
. */
private
final
double
g2
;
/** Convergence limit. */
...
...
@@ -118,7 +118,7 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape {
this
.
f
=
f
;
this
.
ae2
=
ae
*
ae
;
this
.
e2
=
f
*
(
2.0
-
f
);
this
.
e
=
FastMath
.
sqrt
(
this
.
e2
);
this
.
e
=
FastMath
.
sqrt
(
e2
);
this
.
g
=
1.0
-
f
;
this
.
g2
=
g
*
g
;
this
.
ap2
=
ae2
*
g2
;
...
...
@@ -706,11 +706,13 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape {
/** Compute the azimuth angle from local north between the two points.
*
* The angle is calculated clockwise from local north at the origin point and follows the rhumb line to the
* destination point.
* The angle is calculated clockwise from local north at the origin point
* and follows the rhumb line to the destination point.
*
* @param origin the origin point, at which the azimuth angle will be computed (non-{@code null})
* @param destination the destination point, to which the angle is defined (non-{@code null})
* @return the resulting azimuth angle (radians, {@code [0-2pi)})
* @since 11.3
*/
public
double
azimuthBetweenPoints
(
final
GeodeticPoint
origin
,
final
GeodeticPoint
destination
)
{
final
double
dLon
=
MathUtils
.
normalizeAngle
(
destination
.
getLongitude
(),
origin
.
getLongitude
())
-
origin
.
getLongitude
();
...
...
@@ -726,12 +728,14 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape {
/** Compute the azimuth angle from local north between the two points.
*
* The angle is calculated clockwise from local north at the origin point and follows the rhumb line to the
* destination point.
* The angle is calculated clockwise from local north at the origin point
* and follows the rhumb line to the destination point.
*
* @param origin the origin point, at which the azimuth angle will be computed (non-{@code null})
* @param destination the destination point, to which the angle is defined (non-{@code null})
* @param <T> the type of field elements
* @return the resulting azimuth angle (radians, {@code [0-2pi)})
* @since 11.3
*/
public
<
T
extends
CalculusFieldElement
<
T
>>
T
azimuthBetweenPoints
(
final
FieldGeodeticPoint
<
T
>
origin
,
final
FieldGeodeticPoint
<
T
>
destination
)
{
final
T
dLon
=
MathUtils
.
normalizeAngle
(
destination
.
getLongitude
().
subtract
(
origin
.
getLongitude
()),
origin
.
getLongitude
().
getField
().
getZero
());
...
...
@@ -745,11 +749,12 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape {
return
az
;
}
/** Compute the <a href="https://mathworld.wolfram.com/IsometricLatitude.html">isometric latitude</a>
corresponding
* to the provided latitude.
/** Compute the <a href="https://mathworld.wolfram.com/IsometricLatitude.html">isometric latitude</a>
*
corresponding
to the provided latitude.
*
* @param geodeticLatitude the latitude (radians, within interval {@code [-pi/2, +pi/2]})
* @return the isometric latitude (radians)
* @since 11.3
*/
public
double
geodeticToIsometricLatitude
(
final
double
geodeticLatitude
)
{
if
(
FastMath
.
abs
(
geodeticLatitude
)
<=
angularThreshold
)
{
...
...
@@ -766,12 +771,13 @@ public class OneAxisEllipsoid extends Ellipsoid implements BodyShape {
return
a
+
b
;
}
/** Compute the <a href="https://mathworld.wolfram.com/IsometricLatitude.html">isometric latitude</a>
corresponding
* to the provided latitude.
/** Compute the <a href="https://mathworld.wolfram.com/IsometricLatitude.html">isometric latitude</a>
*
corresponding
to the provided latitude.
*
* @param geodeticLatitude the latitude (radians, within interval {@code [-pi/2, +pi/2]})
* @param <T> the type of field elements
* @return the isometric latitude (radians)
* @since 11.3
*/
public
<
T
extends
CalculusFieldElement
<
T
>>
T
geodeticToIsometricLatitude
(
final
T
geodeticLatitude
)
{
if
(
geodeticLatitude
.
abs
().
getReal
()
<=
angularThreshold
)
{
...
...
src/main/java/org/orekit/utils/AggregatedPVCoordinatesProvider.java
View file @
6bd47f2b
...
...
@@ -28,19 +28,23 @@ import org.orekit.time.AbsoluteDate;
* This can be used to describe an aircraft or surface vehicle.
*
* @author Joe Reed
* @since 11.3
*/
public
class
AggregatedPVCoordinatesProvider
implements
PVCoordinatesProvider
{
/** Map of provider instances by transition time. */
private
final
TimeSpanMap
<
PVCoordinatesProvider
>
pvProvMap
;
/** Earliest date at which {@link #getPVCoordinates(AbsoluteDate, Frame)} will return a valid result. */
private
final
AbsoluteDate
minDate
;
/** Latest date at which {@link #getPVCoordinates(AbsoluteDate, Frame)} will return a valid result. */
private
final
AbsoluteDate
maxDate
;
/** Class constructor.
*
* Note the provided {@code map} is used directly. Modification of the
map after calling this constructor
* may result in undefined behavior.
* Note the provided {@code map} is used directly. Modification of the
*
map after calling this constructor
may result in undefined behavior.
*
* @param map the map of {@link PVCoordinatesProvider} instances by time.
*/
...
...
@@ -50,8 +54,8 @@ public class AggregatedPVCoordinatesProvider implements PVCoordinatesProvider {
/** Class constructor.
*
* Note the provided {@code map} is used directly. Modification of the
map after calling this constructor
* may result in undefined behavior.
* Note the provided {@code map} is used directly. Modification of the
*
map after calling this constructor
may result in undefined behavior.
*
* @param map the map of {@link PVCoordinatesProvider} instances by time.
* @param minDate the earliest valid date, {@code null} if always valid
...
...
@@ -86,17 +90,23 @@ public class AggregatedPVCoordinatesProvider implements PVCoordinatesProvider {
return
pvProvMap
.
get
(
date
).
getPVCoordinates
(
date
,
frame
);
}
/**
* Builder class for {@link AggregatedPVCoordinatesProvider}.
*/
public
static
class
Builder
{
/** Time span map holding the incremental values. */
private
TimeSpanMap
<
PVCoordinatesProvider
>
pvProvMap
=
null
;
/** Create a builder using the {@link InvalidPVProvider} as the initial provider.
/**
* Create a builder using the {@link InvalidPVProvider} as the initial provider.
*/
public
Builder
()
{
this
(
new
InvalidPVProvider
());
}
/** Create a builder using the provided initial provider.
/**
* Create a builder using the provided initial provider.
*
* @param initialProvider the inital provider
*/
...
...
@@ -104,8 +114,9 @@ public class AggregatedPVCoordinatesProvider implements PVCoordinatesProvider {
pvProvMap
=
new
TimeSpanMap
<
PVCoordinatesProvider
>(
initialProvider
);
}
/** Add a {@link PVCoordinatesProvider} to the collection. The provided data is the transition
* time, at which this provider will be used.
/** Add a {@link PVCoordinatesProvider} to the collection.
*
* The provided date is the transition time, at which this provider will be used.
*
* @param date the transition date
* @param pvProv the provider
...
...
@@ -113,13 +124,16 @@ public class AggregatedPVCoordinatesProvider implements PVCoordinatesProvider {
* @return this builder instance
* @see TimeSpanMap#addValidAfter(Object, AbsoluteDate, boolean)
*/
public
Builder
addPVProviderAfter
(
final
AbsoluteDate
date
,
final
PVCoordinatesProvider
pvProv
,
final
boolean
erasesLater
)
{
public
Builder
addPVProviderAfter
(
final
AbsoluteDate
date
,
final
PVCoordinatesProvider
pvProv
,
final
boolean
erasesLater
)
{
pvProvMap
.
addValidAfter
(
pvProv
,
date
,
erasesLater
);
return
this
;
}
/** Add a {@link PVCoordinatesProvider} to the collection. The provided data is the final transition
* time, before which this provider will be used.
/** Add a {@link PVCoordinatesProvider} to the collection.
*
* The provided date is the final transition time, before which this provider will be used.
*
* @param date the transition date
* @param pvProv the provider
...
...
src/main/java/org/orekit/utils/ConstantPVCoordinatesProvider.java
View file @
6bd47f2b
...
...
@@ -31,10 +31,13 @@ import org.orekit.time.AbsoluteDate;
* this class when no shifting should be performed (e.g. representing a fixed point on the ground).
*
* @author Joe Reed
* @since 11.3
*/
public
class
ConstantPVCoordinatesProvider
implements
PVCoordinatesProvider
{
/** The position/velocity/acceleration point. */
private
final
PVCoordinates
pva
;
/** The frame in which pva is defined. */
private
final
Frame
sourceFrame
;
...
...
src/main/java/org/orekit/utils/WaypointPVBuilder.java
View file @
6bd47f2b
...
...
@@ -16,8 +16,8 @@
*/
package
org.orekit.utils
;
import
java.util.TreeMap
;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
import
org.hipparchus.geometry.euclidean.threed.Vector3D
;
import
org.hipparchus.geometry.spherical.twod.Circle
;
...
...
@@ -30,29 +30,39 @@ import org.orekit.frames.Frame;
import
org.orekit.frames.TopocentricFrame
;
import
org.orekit.time.AbsoluteDate
;
/** Builder class, enabling incremental building of an {@link PVCoordinatesProvider}
instance using
* waypoints defined on an ellipsoid.
/** Builder class, enabling incremental building of an {@link PVCoordinatesProvider}
*
instance using
waypoints defined on an ellipsoid.
*
* Given a series of waypoints ({@code (date, point)} tuples), build a {@link PVCoordinatesProvider} representing
* the path. The static methods provide implementations for the most common path definitions (cartesian, great-circle,
* loxodrome). If these methods are insufficient, the public constructor provides a way to customize the path definition.
* Given a series of waypoints ({@code (date, point)} tuples),
* build a {@link PVCoordinatesProvider} representing the path.
* The static methods provide implementations for the most common path definitions
* (cartesian, great-circle, loxodrome). If these methods are insufficient,
* the public constructor provides a way to customize the path definition.
*
* This class connects the path segments using the {@link AggregatedPVCoordinatesProvider}. As such, no effort is made to
* smooth the velocity between segments. While position is unaffected, the velocity may be discontinuous between adjacent
* time points. Thus, care should be taken when modeling paths with abrupt direction changes
* (e.g. fast-moving aircraft); understand how the {@link PVCoordinatesProvider} will be used in the particular application.
* This class connects the path segments using the {@link AggregatedPVCoordinatesProvider}.
* As such, no effort is made to smooth the velocity between segments.
* While position is unaffected, the velocity may be discontinuous between adjacent time points.
* Thus, care should be taken when modeling paths with abrupt direction changes
* (e.g. fast-moving aircraft); understand how the {@link PVCoordinatesProvider}
* will be used in the particular application.
*
* @author Joe Reed
* @since 11.3
*/
public
class
WaypointPVBuilder
{
/** Factory used to create intermediate pv providers between waypoints. */
private
final
InterpolationFactory
factory
;
/** Central body, on which the waypoints are defined. */
private
final
OneAxisEllipsoid
body
;
/** Set of waypoints, indexed by time. */
private
final
TreeMap
<
AbsoluteDate
,
GeodeticPoint
>
waypoints
=
new
TreeMap
<>();
/** Whether the resulting provider should be invalid or constant prior to the first waypoint. */
private
boolean
invalidBefore
=
true
;
/** Whether the resulting provider should be invalid or constant after to the last waypoint. */
private
boolean
invalidAfter
=
true
;
...
...
@@ -85,8 +95,8 @@ public class WaypointPVBuilder {
/** Construct a waypoint builder interpolating points using a great-circle.
*
* The altitude of the intermediate points is linearly interpolated from the bounding waypoints.
Extrapolating
* before the first waypoint or after the last waypoint may result in undefined altitudes.
* The altitude of the intermediate points is linearly interpolated from the bounding waypoints.
*
Extrapolating
before the first waypoint or after the last waypoint may result in undefined altitudes.
*
* @param body the reference ellipsoid on which the waypoints are defined.
* @return the waypoint builder
...
...
@@ -115,7 +125,8 @@ public class WaypointPVBuilder {
return
this
;
}
/** Indicate the resulting {@link PVCoordinatesProvider} provide a constant location of the first waypoint prior to the first time.
/** Indicate the resulting {@link PVCoordinatesProvider} provide
* a constant location of the first waypoint prior to the first time.
*
* @return this instance
*/
...
...
@@ -133,7 +144,8 @@ public class WaypointPVBuilder {
return
this
;
}
/** Indicate the resulting {@link PVCoordinatesProvider} provide a constant location of the last waypoint after to the last time.
/** Indicate the resulting {@link PVCoordinatesProvider} provide
* a constant location of the last waypoint after to the last time.
*
* @return this instance
*/
...
...
@@ -147,31 +159,42 @@ public class WaypointPVBuilder {
* @return the coordinates provider instance.
*/
public
PVCoordinatesProvider
build
()
{
final
PVCoordinatesProvider
initialProvider
=
createInitial
(
waypoints
.
firstKey
(),
waypoints
.
firstEntry
().
getValue
());
final
PVCoordinatesProvider
initialProvider
=
createInitial
(
waypoints
.
firstKey
(),
waypoints
.
firstEntry
().
getValue
());
final
AggregatedPVCoordinatesProvider
.
Builder
builder
=
new
AggregatedPVCoordinatesProvider
.
Builder
(
initialProvider
);
Entry
<
AbsoluteDate
,
GeodeticPoint
>
previousEntry
=
null
;
for
(
final
Entry
<
AbsoluteDate
,
GeodeticPoint
>
entry:
waypoints
.
entrySet
())
{
if
(
previousEntry
!=
null
)
{
builder
.
addPVProviderAfter
(
previousEntry
.
getKey
(),
factory
.
create
(
previousEntry
.
getKey
(),
previousEntry
.
getValue
(),
entry
.
getKey
(),
entry
.
getValue
(),
body
),
true
);
builder
.
addPVProviderAfter
(
previousEntry
.
getKey
(),
factory
.
create
(
previousEntry
.
getKey
(),
previousEntry
.
getValue
(),
entry
.
getKey
(),
entry
.
getValue
(),
body
),
true
);
}
previousEntry
=
entry
;
}
// add the point so we're valid at the final waypoint
builder
.
addPVProviderAfter
(
previousEntry
.
getKey
(),
new
ConstantPVCoordinatesProvider
(
previousEntry
.
getValue
(),
body
),
true
);
builder
.
addPVProviderAfter
(
previousEntry
.
getKey
(),
new
ConstantPVCoordinatesProvider
(
previousEntry
.
getValue
(),
body
),
true
);
// add the final propagator after the final waypoint
builder
.
addPVProviderAfter
(
previousEntry
.
getKey
().
shiftedBy
(
Double
.
MIN_VALUE
),
createFinal
(
previousEntry
.
getKey
(),
previousEntry
.
getValue
()),
true
);
builder
.
addPVProviderAfter
(
previousEntry
.
getKey
().
shiftedBy
(
Double
.
MIN_VALUE
),
createFinal
(
previousEntry
.
getKey
(),
previousEntry
.
getValue
()),
true
);
return
builder
.
build
();
}
/** Create the initial provider.
*
* This method uses the internal {@code validBefore} flag to
either return an invalid PVCoordinatesProvider or
* a constant one.
* This method uses the internal {@code validBefore} flag to
*
either return an invalid PVCoordinatesProvider or
a constant one.
*
* @param firstDate the date at which the first waypoint is reached and this provider will no longer be called
* @param firstDate the date at which the first waypoint is reached
* and this provider will no longer be called
* @param firstPoint the first waypoint
* @return the coordinate provider
*/
...
...
@@ -186,10 +209,11 @@ public class WaypointPVBuilder {
/** Create the final provider.
*
* This method uses the internal {@code validAfter} flag to
either return an invalid PVCoordinatesProvider or
* a constant one.
* This method uses the internal {@code validAfter} flag to
*
either return an invalid PVCoordinatesProvider or
a constant one.
*
* @param lastDate the date at which the last waypoint is reached and this provider will be called
* @param lastDate the date at which the last waypoint is reached
* and this provider will be called
* @param lastPoint the last waypoint
* @return the coordinate provider
*/
...
...
@@ -202,12 +226,12 @@ public class WaypointPVBuilder {
}
}
/** Factory interface, creating the {@link PVCoordinatesProvider} instances between the provided waypoints.
*
* @author Joe Reed
/**
* Factory interface, creating the {@link PVCoordinatesProvider} instances between the provided waypoints.
*/
@FunctionalInterface
public
interface
InterpolationFactory
{
/** Create a {@link PVCoordinatesProvider} which interpolates between the provided waypoints.
*
* @param date1 the first waypoint's date
...
...
@@ -217,14 +241,16 @@ public class WaypointPVBuilder {
* @param body the body on which the waypoints are defined
* @return a {@link PVCoordinatesProvider} providing the locations at times between the waypoints.
*/
PVCoordinatesProvider
create
(
AbsoluteDate
date1
,
GeodeticPoint
point1
,
AbsoluteDate
date2
,
GeodeticPoint
point2
,
OneAxisEllipsoid
body
);
PVCoordinatesProvider
create
(
AbsoluteDate
date1
,
GeodeticPoint
point1
,
AbsoluteDate
date2
,
GeodeticPoint
point2
,
OneAxisEllipsoid
body
);
}
/** Coordinate provider interpolating along the great-circle between two points.
*
* @author Joe Reed
/**
* Coordinate provider interpolating along the great-circle between two points.
*/
static
class
GreatCircleWaypointPVProv
implements
PVCoordinatesProvider
{
/** Great circle estimation. */
private
final
Circle
circle
;
/** Duration between the two points (seconds). */
...
...
@@ -253,8 +279,9 @@ public class WaypointPVBuilder {
* @param body the body on which the waypoints are defined
* @see InterpolationFactory
*/
GreatCircleWaypointPVProv
(
final
AbsoluteDate
date1
,
final
GeodeticPoint
point1
,
final
AbsoluteDate
date2
,
final
GeodeticPoint
point2
,
final
OneAxisEllipsoid
body
)
{
GreatCircleWaypointPVProv
(
final
AbsoluteDate
date1
,
final
GeodeticPoint
point1
,
final
AbsoluteDate
date2
,
final
GeodeticPoint
point2
,
final
OneAxisEllipsoid
body
)
{
this
.
t0
=
date1
;
this
.
duration
=
date2
.
durationFrom
(
date1
);
this
.
body
=
body
;
...
...
@@ -299,11 +326,11 @@ public class WaypointPVBuilder {
}
}
/** Coordinate provider interpolating along the loxodrome between two points.
*
* @author Joe Reed
/**
* Coordinate provider interpolating along the loxodrome between two points.
*/
static
class
LoxodromeWaypointPVProv
implements
PVCoordinatesProvider
{