public class Waypoint extends Object implements IEquatable<Waypoint>
The following example shows how to use the WaypointPropagator
to move between waypoints at a constant velocity:
EarthCentralBody earth = CentralBodiesFacet.getFromContext().getEarth();
final double constantVelocity = 80.0;
JulianDate startDate = new JulianDate(new GregorianDate(2007, 12, 6, 12, 0, 0.0));
// Create the start point of our route with a particular date, location, and velocity.
Cartographic point1 = new Cartographic(Trig.degreesToRadians(-77.28), Trig.degreesToRadians(39.94), 3000.0);
Waypoint waypoint1 = new Waypoint(startDate, point1, constantVelocity, 0.0);
// Create the next two waypoints from a location, the same velocity, and the previous waypoint.
Cartographic point2 = new Cartographic(Trig.degreesToRadians(-79.59), Trig.degreesToRadians(38.81), 3000.0);
Waypoint waypoint2 = new Waypoint(waypoint1, earth.getShape(), point2, constantVelocity);
Cartographic point3 = new Cartographic(Trig.degreesToRadians(-81.44), Trig.degreesToRadians(39.69), 3000.0);
Waypoint waypoint3 = new Waypoint(waypoint2, earth.getShape(), point3, constantVelocity);
// Construct the waypoint propagator with all of the waypoints
ArrayList<Waypoint> waypoints = new ArrayList<>();
waypoints.add(waypoint1);
waypoints.add(waypoint2);
waypoints.add(waypoint3);
WaypointPropagator propagator = new WaypointPropagator(earth, waypoints);
// The propagator can then be used to create a Point that represents the position and velocity of the
// vehicle moving between the waypoints.
Point propagatedPoint = propagator.createPoint();
// Or an entire set of ephemeris can be computed at a specified time step.
DateMotionCollection1<Cartesian> ephemeris = propagator.propagate(waypoint1.getDate(), waypoint3.getDate(), Duration.fromSeconds(60.0), 1,
propagator.getReferenceFrame());
Constructor and Description |
---|
Waypoint(JulianDate date,
Cartographic location,
double groundSpeed,
double rateOfClimb)
Initializes a new instance.
|
Waypoint(Waypoint previousWaypoint,
Ellipsoid shape,
Cartographic location,
double groundSpeed)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
static boolean |
equals(Waypoint left,
Waypoint right)
Returns
true if the two instances are exactly equal. |
boolean |
equalsType(Waypoint other)
Indicates whether another instance of this type is equal to this instance.
|
JulianDate |
getDate()
Gets the date at which the waypoint is achieved.
|
double |
getGroundSpeed()
Gets the speed tangent to the ellipsoid surface.
|
Cartographic |
getLocation()
Gets the planetodetic position at the waypoint.
|
double |
getRateOfClimb()
Gets the velocity normal to the ellipsoid surface.
|
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
static boolean |
notEquals(Waypoint left,
Waypoint right)
Returns
true if the two instances are not exactly equal. |
public Waypoint(@Nonnull JulianDate date, @Nonnull Cartographic location, double groundSpeed, double rateOfClimb)
date
- The date at which the waypoint is achieved.location
- The planetodetic position at the waypoint.groundSpeed
- The speed tangent to the ellipsoid surface.rateOfClimb
- The velocity normal to the ellipsoid surface.public Waypoint(Waypoint previousWaypoint, Ellipsoid shape, @Nonnull Cartographic location, double groundSpeed)
If the previous waypoint is at a different altitude than this one, a RateOfClimb
(get
) will be
selected to achieve a constant vertical acceleration.
previousWaypoint
- The previous waypoint in the route.shape
- The shape model on which the waypoints are specified. This will typically be
CentralBodiesFacet.GetFromContext().Earth.Shape
.location
- The planetodetic location of the new waypoint.groundSpeed
- The speed at which to arrive at this waypoint.@Nonnull public final JulianDate getDate()
@Nonnull public final Cartographic getLocation()
public final double getGroundSpeed()
public final double getRateOfClimb()
public final boolean equalsType(Waypoint other)
equalsType
in interface IEquatable<Waypoint>
other
- The instance to compare to this instance.true
if other
represents the same value as this instance; otherwise false
.public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare to this instance.true
if obj
is an instance of this type and represents the same value as this instance; otherwise false
.Object.hashCode()
,
HashMap
public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public static boolean equals(Waypoint left, Waypoint right)
true
if the two instances are exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
represents the same value as right
; otherwise false
.public static boolean notEquals(Waypoint left, Waypoint right)
true
if the two instances are not exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
does not represent the same value as right
; otherwise false
.