jme3tools.navigation
Class NavCalculator

java.lang.Object
  extended by jme3tools.navigation.NavCalculator

public class NavCalculator
extends java.lang.Object

A utlity class for performing position calculations

Since:
1.0

Nested Class Summary
static class NavCalculator.Quadrant
           
 
Field Summary
static int GC
           
static int MERCATOR
           
static int METERS_PER_MINUTE
           
static int RL_CRS_PRECISION
           
static int RL_DIST_PRECISION
           
static int WGS84_EARTH_RADIUS
           
 
Constructor Summary
NavCalculator()
          Constructor
NavCalculator(Position P1, Position P2, int calcType)
          Constructor
 
Method Summary
static int computeAngle(Position p1, Position p2)
          Computes the angle between two points.
static int computeBearing(Position p1, Position p2)
          Computes the bearing between two points.
static double computeDLat(double lat1, double lat2)
          Compute the difference in latitude between two positions
static double computeDLong(double lng1, double lng2)
          Computes the difference in Longitude between two positions and assigns the correct sign -westwards travel, + eastwards travel
static double computeDMPClarkeSpheroid(double lat1, double lat2)
          Computes the difference in meridional parts for two latitudes in minutes (based on Clark 1880 spheroid)
static float computeDMPWGS84Spheroid(float lat1, float lat2)
          Computes the difference in meridional parts for a perfect sphere between two degrees of latitude
static int computeHeading(Position p1, Position p2)
           
static double computeLongDiff(double lng1, double lng2)
          Computes the difference in Longitude between two positions and assigns the correct sign -westwards travel, + eastwards travel
static Position computePosition(Position initialPos, double heading, double distance)
          Computes the coordinate of position B relative to an offset given a distance and an angle.
static double convertCourse(float tc, Position p1, Position p2)
          Converts a course from cardinal XddY to ddd notation
 double getDistance()
          Getter method for the distance between two points
 java.lang.String getStrCourse()
          Getter method for the true course
 double getTrueCourse()
          Getter method for the true course
 GCSailing greatCircleSailing(Position p1, Position p2)
          Determines a great circle track between two positions
static void main(java.lang.String[] args)
           
 RLSailing mercatorSailing(Position p1, Position p2)
          Determines the rhumb line course and distance between two positions
 RLSailing planeSailing(Position p1, Position p2)
          Calculate a plane sailing situation - i.e.
static Position predictPosition(int time, double speed, double currentLat, double currentLong, double course)
          Predicts the position of a target for a given time in the future
 RLSailing rhumbLineSailing(Position p1, Position p2)
          Determines a Rhumb Line course and distance between two points
static double toDegrees(double meters)
          Converts meters to degrees.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WGS84_EARTH_RADIUS

public static final int WGS84_EARTH_RADIUS
See Also:
Constant Field Values

MERCATOR

public static final int MERCATOR
See Also:
Constant Field Values

GC

public static final int GC
See Also:
Constant Field Values

RL_CRS_PRECISION

public static final int RL_CRS_PRECISION
See Also:
Constant Field Values

RL_DIST_PRECISION

public static final int RL_DIST_PRECISION
See Also:
Constant Field Values

METERS_PER_MINUTE

public static final int METERS_PER_MINUTE
See Also:
Constant Field Values
Constructor Detail

NavCalculator

public NavCalculator(Position P1,
                     Position P2,
                     int calcType)
Constructor

Parameters:
P1 -
P2 -
calcType -
Since:
1.0

NavCalculator

public NavCalculator()
Constructor

Since:
1.0
Method Detail

greatCircleSailing

public GCSailing greatCircleSailing(Position p1,
                                    Position p2)
Determines a great circle track between two positions

Parameters:
p1 - origin position
p2 - destination position

rhumbLineSailing

public RLSailing rhumbLineSailing(Position p1,
                                  Position p2)
Determines a Rhumb Line course and distance between two points

Parameters:
p1 - origin position
p2 - destination position

mercatorSailing

public RLSailing mercatorSailing(Position p1,
                                 Position p2)
Determines the rhumb line course and distance between two positions

Parameters:
p1 - origin position
p2 - destination position

planeSailing

public RLSailing planeSailing(Position p1,
                              Position p2)
Calculate a plane sailing situation - i.e. where Lats are the same

Parameters:
p1 -
p2 -
Returns:
Since:
1.0

convertCourse

public static double convertCourse(float tc,
                                   Position p1,
                                   Position p2)
Converts a course from cardinal XddY to ddd notation

Parameters:
tc -
p1 - position one
p2 - position two
Returns:
Since:
1.0

getDistance

public double getDistance()
Getter method for the distance between two points

Returns:
distance
Since:
1.0

getTrueCourse

public double getTrueCourse()
Getter method for the true course

Returns:
true course
Since:
1.0

getStrCourse

public java.lang.String getStrCourse()
Getter method for the true course

Returns:
true course
Since:
1.0

computeDMPClarkeSpheroid

public static double computeDMPClarkeSpheroid(double lat1,
                                              double lat2)
Computes the difference in meridional parts for two latitudes in minutes (based on Clark 1880 spheroid)

Parameters:
lat1 -
lat2 -
Returns:
difference in minutes
Since:
1.0

computeDMPWGS84Spheroid

public static float computeDMPWGS84Spheroid(float lat1,
                                            float lat2)
Computes the difference in meridional parts for a perfect sphere between two degrees of latitude

Parameters:
lat1 -
lat2 -
Returns:
difference in meridional parts between lat1 and lat2 in minutes
Since:
1.0

predictPosition

public static Position predictPosition(int time,
                                       double speed,
                                       double currentLat,
                                       double currentLong,
                                       double course)
Predicts the position of a target for a given time in the future

Parameters:
time - the number of seconds from now for which to predict the future position
speed - the miles per minute that the target is traveling
currentLat - the target's current latitude
currentLong - the target's current longitude
course - the target's current course in degrees
Returns:
the predicted future position
Since:
1.0

computePosition

public static Position computePosition(Position initialPos,
                                       double heading,
                                       double distance)
Computes the coordinate of position B relative to an offset given a distance and an angle.

Parameters:
offset - The offset position.
bearing - The bearing between the offset and the coordinate that you want to calculate.
distance - The distance, in meters, between the offset and point B.
Returns:
The position of point B that is located from given offset at given distance and angle.
Since:
1.0

computeDLong

public static double computeDLong(double lng1,
                                  double lng2)
Computes the difference in Longitude between two positions and assigns the correct sign -westwards travel, + eastwards travel

Parameters:
lng1 -
lng2 -
Returns:
difference in longitude
Since:
1.0

computeLongDiff

public static double computeLongDiff(double lng1,
                                     double lng2)
Computes the difference in Longitude between two positions and assigns the correct sign -westwards travel, + eastwards travel

Parameters:
lng1 -
lng2 -
Returns:
difference in longitude
Since:
1.0

computeDLat

public static double computeDLat(double lat1,
                                 double lat2)
Compute the difference in latitude between two positions

Parameters:
lat1 -
lat2 -
Returns:
difference in latitude
Since:
1.0

toDegrees

public static double toDegrees(double meters)
Converts meters to degrees.

Parameters:
meters - The meters that you want to convert into degrees.
Returns:
The degree equivalent of the given meters.
Since:
1.0

computeBearing

public static int computeBearing(Position p1,
                                 Position p2)
Computes the bearing between two points.

Parameters:
p1 -
p2 -
Returns:
Since:
1.0

computeAngle

public static int computeAngle(Position p1,
                               Position p2)
Computes the angle between two points.

Parameters:
p1 -
p2 -
Returns:

computeHeading

public static int computeHeading(Position p1,
                                 Position p2)

main

public static void main(java.lang.String[] args)