com.bbn.openmap.proj
Class GreatCircle

java.lang.Object
  extended by com.bbn.openmap.proj.GreatCircle

public class GreatCircle
extends java.lang.Object

Methods for calculating great circle and other distances on the sphere and ellipsoid. Note that as of OpenMap 4.7, all the method calls with a '_' in them have been deprecated, replaced by method names that conform to Java conventions.

Spherical equations taken from John Synder's Map Projections --A Working Manual , pp29-31.
Latitude/longitude arguments must be in valid radians: -PI<=lambda<PI, -PI/2<=phi<=PI/2


Method Summary
static double[] earth_circle(double phi1, double lambda0, double c, double s, double e, int n)
          Deprecated. use earthCircle instead.
static double[] earth_circle(double phi1, double lambda0, double c, double s, double e, int n, double[] ret_val)
          Deprecated. use earthCorcle instead.
static double[] earth_circle(double phi1, double lambda0, double c, int n)
          Deprecated. use earthCircle instead.
static double[] earth_circle(double phi1, double lambda0, double c, int n, double[] ret_val)
          Deprecated. use earthCircle instead.
static float[] earth_circle(float phi1, float lambda0, float c, float s, float e, int n)
          Deprecated. use earthCircle instead.
static float[] earth_circle(float phi1, float lambda0, float c, float s, float e, int n, float[] ret_val)
          Deprecated. use earthCircle instead.
static float[] earth_circle(float phi1, float lambda0, float c, int n)
          Deprecated. use earthCircle instead.
static float[] earth_circle(float phi1, float lambda0, float c, int n, float[] ret_val)
          Deprecated. use earthCircle instead.
static double[] earthCircle(double phi1, double lambda0, double c, double s, double e, int n)
          Calculate partial earth circle on the sphere with double precision.
static double[] earthCircle(double phi1, double lambda0, double c, double s, double e, int n, double[] ret_val)
          Calculate earth circle in the sphere in double precision.
static double[] earthCircle(double phi1, double lambda0, double c, int n)
          Calculate earth circle on the sphere with double precision.
static double[] earthCircle(double phi1, double lambda0, double c, int n, double[] ret_val)
          Calculate earth circle in the sphere with double precision.
static float[] earthCircle(float phi1, float lambda0, float c, float s, float e, int n)
          Calculate partial earth circle on the sphere.
static float[] earthCircle(float phi1, float lambda0, float c, float s, float e, int n, float[] ret_val)
          Calculate earth circle in the sphere.
static float[] earthCircle(float phi1, float lambda0, float c, int n)
          Calculate earth circle on the sphere.
static float[] earthCircle(float phi1, float lambda0, float c, int n, float[] ret_val)
          Calculate earth circle in the sphere.
static AziDist ellipsoidalAziDist(double a, double finv, double glat1, double glon1, double glat2, double glon2, AziDist ret_val)
          Deprecated. this has been yanked until we have a more stable and documented algorithm
static double[] great_circle(double phi1, double lambda0, double phi, double lambda, int n, boolean include_last)
          Deprecated. use greatCircle instead.
static float[] great_circle(float phi1, float lambda0, float phi, float lambda, int n, boolean include_last)
          Deprecated. use greatCircle instead.
static double[] greatCircle(double phi1, double lambda0, double phi, double lambda, int n, boolean include_last)
          Calculate great circle between two points on the sphere with double precision.
static float[] greatCircle(float phi1, float lambda0, float phi, float lambda, int n, boolean include_last)
          Calculate great circle between two points on the sphere.
static LatLonPoint pointAtDistanceBetweenPoints(double phi1, double lambda0, double phi, double lambda, double distance, int n)
          Return a point that is approximately a certain distance along the great circle line between two points.
static double spherical_azimuth(double phi1, double lambda0, double phi, double lambda)
          Deprecated. use sphericalAzimuth instead.
static float spherical_azimuth(float phi1, float lambda0, float phi, float lambda)
          Deprecated. use sphericalAzimuth instead.
static LatLonPoint spherical_between(double phi1, double lambda0, double c, double Az)
          Deprecated. use sphericalBetween instead.
static double[] spherical_between(double phi1, double lambda0, double c, double Az, int n)
          Deprecated. use shpericalBetween instead.
static LatLonPoint spherical_between(float phi1, float lambda0, float c, float Az)
          Deprecated. use shoerucalBetween instead.
static float[] spherical_between(float phi1, float lambda0, float c, float Az, int n)
          Deprecated. use sphericalBetween instead.
static double spherical_distance(double phi1, double lambda0, double phi, double lambda)
          Deprecated. use sphericalDistance instead.
static float spherical_distance(float phi1, float lambda0, float phi, float lambda)
          Deprecated. use sphericalDistance instead.
static double sphericalAzimuth(double phi1, double lambda0, double phi, double lambda)
          Calculate spherical azimuth between two points with double precision.
static float sphericalAzimuth(float phi1, float lambda0, float phi, float lambda)
          Calculate spherical azimuth between two points.
static LatLonPoint sphericalBetween(double phi1, double lambda0, double c, double Az)
          Calculate point at azimuth and distance from another point, with double precision.
static double[] sphericalBetween(double phi1, double lambda0, double c, double Az, int n)
          Calculate point between two points with double precision.
static LatLonPoint sphericalBetween(float phi1, float lambda0, float c, float Az)
          Calculate point at azimuth and distance from another point.
static float[] sphericalBetween(float phi1, float lambda0, float c, float Az, int n)
          Calculate point between two points.
static double sphericalDistance(double phi1, double lambda0, double phi, double lambda)
          Calculate spherical arc distance between two points with double precision.
static float sphericalDistance(float phi1, float lambda0, float phi, float lambda)
          Calculate spherical arc distance between two points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

ellipsoidalAziDist

public static final AziDist ellipsoidalAziDist(double a,
                                               double finv,
                                               double glat1,
                                               double glon1,
                                               double glat2,
                                               double glon2,
                                               AziDist ret_val)
Deprecated. this has been yanked until we have a more stable and documented algorithm

Determine azimuth and distance on the ellipsoid.

Parameters:
a - Semi-major axis of ellipsoid
finv - flattening of the ellipsoid (WGS84 is 1/298.257)
glat1 - Latitude of from station
glon1 - Longitude of from station
glat2 - Latitude of to station
glon2 - Longitude of to station
ret_val - AziDist struct
Returns:
AziDist ret_val struct with azimuth and distance

sphericalDistance

public static final float sphericalDistance(float phi1,
                                            float lambda0,
                                            float phi,
                                            float lambda)
Calculate spherical arc distance between two points.

Computes arc distance `c' on the sphere. equation (5-3a). (0 <= c <= PI)

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
phi - latitude in radians of end point
lambda - longitude in radians of end point
Returns:
float arc distance `c'

spherical_distance

public static final float spherical_distance(float phi1,
                                             float lambda0,
                                             float phi,
                                             float lambda)
Deprecated. use sphericalDistance instead.


sphericalDistance

public static final double sphericalDistance(double phi1,
                                             double lambda0,
                                             double phi,
                                             double lambda)
Calculate spherical arc distance between two points with double precision.

Computes arc distance `c' on the sphere. equation (5-3a). (0 <= c <= PI)

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
phi - latitude in radians of end point
lambda - longitude in radians of end point
Returns:
float arc distance `c'

spherical_distance

public static final double spherical_distance(double phi1,
                                              double lambda0,
                                              double phi,
                                              double lambda)
Deprecated. use sphericalDistance instead.


sphericalAzimuth

public static final float sphericalAzimuth(float phi1,
                                           float lambda0,
                                           float phi,
                                           float lambda)
Calculate spherical azimuth between two points.

Computes the azimuth `Az' east of north from phi1, lambda0 bearing toward phi and lambda. (5-4b). (-PI <= Az <= PI).

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
phi - latitude in radians of end point
lambda - longitude in radians of end point
Returns:
float azimuth east of north `Az'

spherical_azimuth

public static final float spherical_azimuth(float phi1,
                                            float lambda0,
                                            float phi,
                                            float lambda)
Deprecated. use sphericalAzimuth instead.


sphericalAzimuth

public static final double sphericalAzimuth(double phi1,
                                            double lambda0,
                                            double phi,
                                            double lambda)
Calculate spherical azimuth between two points with double precision.

Computes the azimuth `Az' east of north from phi1, lambda0 bearing toward phi and lambda. (5-4b). (-PI <= Az <= PI).

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
phi - latitude in radians of end point
lambda - longitude in radians of end point
Returns:
float azimuth east of north `Az'

spherical_azimuth

public static final double spherical_azimuth(double phi1,
                                             double lambda0,
                                             double phi,
                                             double lambda)
Deprecated. use sphericalAzimuth instead.


sphericalBetween

public static final LatLonPoint sphericalBetween(float phi1,
                                                 float lambda0,
                                                 float c,
                                                 float Az)
Calculate point at azimuth and distance from another point.

Returns a LatLonPoint.Float at arc distance `c' in direction `Az' from start point.

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
c - arc radius in radians (0 < c <= PI)
Az - azimuth (direction) east of north (-PI <= Az < PI)
Returns:
LatLonPoint

spherical_between

public static final LatLonPoint spherical_between(float phi1,
                                                  float lambda0,
                                                  float c,
                                                  float Az)
Deprecated. use shoerucalBetween instead.


sphericalBetween

public static final LatLonPoint sphericalBetween(double phi1,
                                                 double lambda0,
                                                 double c,
                                                 double Az)
Calculate point at azimuth and distance from another point, with double precision.

Returns a LatLonPoint.Double at arc distance `c' in direction `Az' from start point.

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
c - arc radius in radians (0 < c <= PI)
Az - azimuth (direction) east of north (-PI <= Az < PI)
Returns:
LatLonPoint

spherical_between

public static final LatLonPoint spherical_between(double phi1,
                                                  double lambda0,
                                                  double c,
                                                  double Az)
Deprecated. use sphericalBetween instead.


sphericalBetween

public static final float[] sphericalBetween(float phi1,
                                             float lambda0,
                                             float c,
                                             float Az,
                                             int n)
Calculate point between two points.

Same as spherical_between() above except it calculates n equal segments along the length of c.

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
c - arc radius in radians (0 < c <= PI)
Az - azimuth (direction) east of north (-PI <= Az < PI)
n - number of points along great circle edge to calculate
Returns:
float[n+1] radian lat,lon pairs

spherical_between

public static final float[] spherical_between(float phi1,
                                              float lambda0,
                                              float c,
                                              float Az,
                                              int n)
Deprecated. use sphericalBetween instead.


sphericalBetween

public static final double[] sphericalBetween(double phi1,
                                              double lambda0,
                                              double c,
                                              double Az,
                                              int n)
Calculate point between two points with double precision.

Same as spherical_between() above except it calculates n equal segments along the length of c.

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
c - arc radius in radians (0 < c <= PI)
Az - azimuth (direction) east of north (-PI <= Az < PI)
n - number of points along great circle edge to calculate
Returns:
double[n+1] radian lat,lon pairs

spherical_between

public static final double[] spherical_between(double phi1,
                                               double lambda0,
                                               double c,
                                               double Az,
                                               int n)
Deprecated. use shpericalBetween instead.


greatCircle

public static final float[] greatCircle(float phi1,
                                        float lambda0,
                                        float phi,
                                        float lambda,
                                        int n,
                                        boolean include_last)
Calculate great circle between two points on the sphere.

Folds all computation (distance, azimuth, points between) into one function for optimization. returns n or n+1 pairs of lat,lon on great circle between lat-lon pairs.

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
phi - latitude in radians of end point
lambda - longitude in radians of end point
n - number of segments
include_last - return n or n+1 segments
Returns:
float[n] or float[n+1] radian lat,lon pairs

great_circle

public static final float[] great_circle(float phi1,
                                         float lambda0,
                                         float phi,
                                         float lambda,
                                         int n,
                                         boolean include_last)
Deprecated. use greatCircle instead.


greatCircle

public static final double[] greatCircle(double phi1,
                                         double lambda0,
                                         double phi,
                                         double lambda,
                                         int n,
                                         boolean include_last)
Calculate great circle between two points on the sphere with double precision.

Folds all computation (distance, azimuth, points between) into one function for optimization. returns n or n+1 pairs of lat,lon on great circle between lat-lon pairs.

Parameters:
phi1 - latitude in radians of start point
lambda0 - longitude in radians of start point
phi - latitude in radians of end point
lambda - longitude in radians of end point
n - number of segments
include_last - return n or n+1 segments
Returns:
double[n] or double[n+1] radian lat,lon pairs

pointAtDistanceBetweenPoints

public static LatLonPoint pointAtDistanceBetweenPoints(double phi1,
                                                       double lambda0,
                                                       double phi,
                                                       double lambda,
                                                       double distance,
                                                       int n)
Return a point that is approximately a certain distance along the great circle line between two points. Returns the nearest coordinate along a set of calculated segments (as dictated by n) that fits the desired distance.

Parameters:
phi1 - latitude of point 1 in radians.
lambda0 - longitude of point 1 in radians.
phi - latitude of point 2 in radians.
lambda - longitude of point 2 in radians.
distance - in radians.
n - number of segments to divide path into. The more segments, the more accurate. If n <= 0, the OpenMap default of 512 is used.
Returns:
LatLonPoint if distance is less than distance between points, null if it is greater.

great_circle

public static final double[] great_circle(double phi1,
                                          double lambda0,
                                          double phi,
                                          double lambda,
                                          int n,
                                          boolean include_last)
Deprecated. use greatCircle instead.


earthCircle

public static final float[] earthCircle(float phi1,
                                        float lambda0,
                                        float c,
                                        float s,
                                        float e,
                                        int n)
Calculate partial earth circle on the sphere.

Returns n float lat,lon pairs at arc distance c from point at phi1,lambda0.

Parameters:
phi1 - latitude in radians of center point
lambda0 - longitude in radians of center point
c - arc radius in radians (0 < c < PI)
s - starting angle in radians. North up is zero.
e - angular extent in radians, clockwise right from starting angle.
n - number of points along circle edge to calculate
Returns:
float[n] radian lat,lon pairs along earth circle

earth_circle

public static final float[] earth_circle(float phi1,
                                         float lambda0,
                                         float c,
                                         float s,
                                         float e,
                                         int n)
Deprecated. use earthCircle instead.


earthCircle

public static final float[] earthCircle(float phi1,
                                        float lambda0,
                                        float c,
                                        int n)
Calculate earth circle on the sphere.

Returns n float lat,lon pairs at arc distance c from point at phi1,lambda0.

Parameters:
phi1 - latitude in radians of center point
lambda0 - longitude in radians of center point
c - arc radius in radians (0 < c < PI)
n - number of points along circle edge to calculate
Returns:
float[n] radian lat,lon pairs along earth circle

earth_circle

public static final float[] earth_circle(float phi1,
                                         float lambda0,
                                         float c,
                                         int n)
Deprecated. use earthCircle instead.


earthCircle

public static final float[] earthCircle(float phi1,
                                        float lambda0,
                                        float c,
                                        int n,
                                        float[] ret_val)
Calculate earth circle in the sphere.

Returns n float lat,lon pairs at arc distance c from point at phi1,lambda0.

Parameters:
phi1 - latitude in radians of center point
lambda0 - longitude in radians of center point
c - arc radius in radians (0 < c < PI)
n - number of points along circle edge to calculate
ret_val - float[] ret_val array of n*2 number of points along circle edge to calculate
Returns:
float[n] radian lat,lon pairs along earth circle

earth_circle

public static final float[] earth_circle(float phi1,
                                         float lambda0,
                                         float c,
                                         int n,
                                         float[] ret_val)
Deprecated. use earthCircle instead.


earthCircle

public static final float[] earthCircle(float phi1,
                                        float lambda0,
                                        float c,
                                        float s,
                                        float e,
                                        int n,
                                        float[] ret_val)
Calculate earth circle in the sphere.

Returns n float lat,lon pairs at arc distance c from point at phi1,lambda0.

Parameters:
phi1 - latitude in radians of center point.
lambda0 - longitude in radians of center point.
c - arc radius in radians (0 < c < PI).
s - starting angle in radians. North up is zero.
e - angular extent in radians, clockwise right from starting angle.
n - number of points along circle edge to calculate.
ret_val - float[] ret_val array of n*2 number of points along circle edge to calculate.
Returns:
float[n] radian lat,lon pairs along earth circle.

earth_circle

public static final float[] earth_circle(float phi1,
                                         float lambda0,
                                         float c,
                                         float s,
                                         float e,
                                         int n,
                                         float[] ret_val)
Deprecated. use earthCircle instead.


earthCircle

public static final double[] earthCircle(double phi1,
                                         double lambda0,
                                         double c,
                                         double s,
                                         double e,
                                         int n)
Calculate partial earth circle on the sphere with double precision.

Returns n double lat,lon pairs at arc distance c from point at phi1,lambda0.

Parameters:
phi1 - latitude in radians of center point
lambda0 - longitude in radians of center point
c - arc radius in radians (0 < c < PI)
s - starting angle in radians. North up is zero.
e - angular extent in radians, clockwise right from starting angle.
n - number of points along circle edge to calculate
Returns:
double[n] radian lat,lon pairs along earth circle

earth_circle

public static final double[] earth_circle(double phi1,
                                          double lambda0,
                                          double c,
                                          double s,
                                          double e,
                                          int n)
Deprecated. use earthCircle instead.


earthCircle

public static final double[] earthCircle(double phi1,
                                         double lambda0,
                                         double c,
                                         int n)
Calculate earth circle on the sphere with double precision.

Returns n double lat,lon pairs at arc distance c from point at phi1,lambda0.

Parameters:
phi1 - latitude in radians of center point
lambda0 - longitude in radians of center point
c - arc radius in radians (0 < c < PI)
n - number of points along circle edge to calculate
Returns:
double[n] radian lat,lon pairs along earth circle

earth_circle

public static final double[] earth_circle(double phi1,
                                          double lambda0,
                                          double c,
                                          int n)
Deprecated. use earthCircle instead.


earthCircle

public static final double[] earthCircle(double phi1,
                                         double lambda0,
                                         double c,
                                         int n,
                                         double[] ret_val)
Calculate earth circle in the sphere with double precision.

Returns n float lat,lon pairs at arc distance c from point at phi1,lambda0.

Parameters:
phi1 - latitude in radians of center point
lambda0 - longitude in radians of center point
c - arc radius in radians (0 < c < PI)
n - number of points along circle edge to calculate
ret_val - double[] ret_val array of n*2 number of points along circle edge to calculate
Returns:
double[n] radian lat,lon pairs along earth circle

earth_circle

public static final double[] earth_circle(double phi1,
                                          double lambda0,
                                          double c,
                                          int n,
                                          double[] ret_val)
Deprecated. use earthCircle instead.


earthCircle

public static final double[] earthCircle(double phi1,
                                         double lambda0,
                                         double c,
                                         double s,
                                         double e,
                                         int n,
                                         double[] ret_val)
Calculate earth circle in the sphere in double precision.

Returns n double lat,lon pairs at arc distance c from point at phi1,lambda0.

Parameters:
phi1 - latitude in radians of center point.
lambda0 - longitude in radians of center point.
c - arc radius in radians (0 < c < PI).
s - starting angle in radians. North up is zero.
e - angular extent in radians, clockwise right from starting angle.
n - number of points along circle edge to calculate.
ret_val - double[] ret_val array of n*2 number of points along circle edge to calculate.
Returns:
double[n] radian lat,lon pairs along earth circle.

earth_circle

public static final double[] earth_circle(double phi1,
                                          double lambda0,
                                          double c,
                                          double s,
                                          double e,
                                          int n,
                                          double[] ret_val)
Deprecated. use earthCorcle instead.



Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details