Package com.irurueta.navigation.geodesic
Class Geodesic
java.lang.Object
com.irurueta.navigation.geodesic.Geodesic
Geodesic calculations.
The shortest path between two points on an ellipsoid at (lat1, lon1) and
(lat2, lon2) is called the geodesic. Its length is s12 and the geodesic
from point 1 to point 2 has azimuths azi1 and azi2 at the two end points. (The
azimuth is the heading measured clockwise from north. azi2 is the "forward" azimuth, i.e.,
the heading that takes you beyond point 2 not back to point 1.).
Given lat1, lon1, azi1, and s12, we can determine lat2,
lon2, and azi2. This is the direct geodesic problem and its solution is given
by th function
direct(double, double, double, double). (If s12 is sufficiently large that the geodesic wraps
more than halfway around the earth, there will be another geodesic between the points with
a smaller s12.)
Given lat1, lon1, lat2, and lon2, we can determine azi1,
azi2, and s12. This is the inverse geodesic problem, whose solution is
given by inverse(double, double, double, double). Usually, the solution to the inverse problem is unique. In cases where
there are multiple solutions (all with the same s12, of course), all the solutions can be
easily generated once a particular solution is provided.
The standard way of specifying the direct problem is to specify the distance s12 to the
second point. However, it is sometimes useful instead to specify the arc length a12 (in
degrees) on the auxiliary sphere. This is a mathematical construct used in solving the geodesic
problems. The solution of the direct problem in this form is provided by arcDirect(double, double, double, double). An
arc length in excess of 180° indicates that the geodesic is not the shortest path. In addition,
the arc length between an equatorial crossing and the next extremum of latitude for a geodesic is
90°.
This class can also calculate several other quantities related to geodesics. These are:
- reduced length. If we fix the first point and increase azi1 by dazi1 (radians), the second point is displaced m12 dazi1 in the direction azi2 + 90°. The quantity m12 is called the "reduced length" and is symmetric under interchange of the two points. On a curved surface the reduced length obeys a symmetry relation, m12 + m21 = 0. On a flat surface, we have m12 = s12. The ratio s12/m12 gives the azimuthal scale for an azimuthal equidistant projection.
- geodesic scale. Consider a reference geodesic and a second geodesic parallel to this one at point 1 and separated by a small distance dt. The separation of the two geodesics at point 2 is M12dt where M12 is called the "geodesic scale". M21 is defined similarly (with the geodesics being parallel at point 2). On a flat surface, we have M12 = M21 = 1. The quantity 1/M12 gives the scale of the Cassini-Soldner projection.
- area. The area between the geodesic from point 1 to point 2 and the equation is represented by S12; it is the area, measured counter-clockwise, of the geodesic quadrilateral with corners (lat1, lon1), (0, lon1), (0, lon2), and (lat2, lon2). It can be used to compute the area of any single geodesic polygon.
- s13 = s12 + s23
- a13 = a12 + a23
- S13 = S12 + S23
- m13 = m12 M23 + m23 M21
- M13 = M12 M23 − (1 − M12 M21) m23 / m12
- M31 = M32 M21 − (1 − M23 M32) m12 / m23
GeodesicData object which includes the
input parameters and all the computed results, i.e. lat1, lon1, azi1, lat2,
lon2, azi2, s12, a12, m12, M12, M21, S12.
The functions direct(double, double, double, double, int),
arcDirect(double, double, double, double, int) and inverse(double, double, double, double, int)
include an optional final argument outmask which allows you to specify which results should be computed and
returned. If you omit outmask, then the "standard" geodesic results are computed (latitudes, longitudes,
azimuths, and distance). outmask is bitor'ed combination of GeodesicMask values. For example, if
you wish just to compute the distance between two points you would call, e.g.,
GeodesicData g = Geodesic.WGS84.inverse(lat1, lon1, lat2, lon2, GeodesicMask.DISTANCE);
Additional functionality is provided by the GeodesicLine class, which allows a sequence of points along a
geodesic to be computed.
The shortest distance returned by the solution of the inverse problem is (obviously) uniquely defined. However, in
a few special cases there are multiple azimuths which yield the same shortest distance. Here is a catalog of those
cases:
- lat1 = −lat2 (with neither point at a pole). If azi1 = azi2, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [azi1, azi2] → [azi2, azi1], [M12, M21] → [M21, M12], S12 → −S12. (This occurs when the longitude difference is near ±180° for oblate ellipsoids.)
- lon2 = lon1 + 180° (with neither point at pole). If azi1 = 0° or ±180°, the geodesic is unique. Otherwise there are two geodesics and the second one is obtained by setting [azi1, azi2] → [−azi1, −azi2], S12 → − S12. (This occurs when lat2 is near −lat1 for prolate ellipsoids.)
- Points 1 and 2 at opposite poles. There are infinitely many geodesics which can be generated by setting [azi1, azi2] → [azi1, azi2] + [d, −d], for arbitrary d. (For spheres, this prescription applies when points 1 and 2 are antipodal.)
- s12 = 0 (coincident points). There are infinitely many geodesics which can be generated by setting [azi1, azi2] → [azi1, azi2] + [d, d], for arbitrary d.
|f| error
0.01 25 nm
0.02 30 nm
0.05 10 um
0.1 1.5 mm
0.2 300 mm
The algorithms are described in
- C.F.F Karney, Algorithms for geodesics, J. Geodesy 87, 43–55 (2013)
//Solve the direct geodesic problem.
//This program reads in lines with lat1, lon1, azi1, s12 and prints out lines with lat2, lon2, azi2
//(for the WGS84 ellipsoid).
import java.util.*;
import com.irurueta.navigation.geodesic.*;
public class Direct {
public static void main(String[] args) {
try {
Scanner in = new Scanner(System.in);
double lat1, lon1, azi1, s12;
while (true) {
lat1 = in.nextDouble();
lon1 = in.nextDouble();
azi1 = in.nextDouble();
s12 = in.nextDouble();
GeodesicData g = Geodesic.WGS84.direct(lat1, lon1, azi1, s12);
System.out.println(g.lat2 + " " + g.lon2 + " " + g.azi2);
}
} catch (Exception e) { }
}
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final doubleprivate final double[]protected final doubleprotected final doubleprivate final double[]private final double[]protected final doubleprotected final doubleprivate final doubleprotected final doubleprotected final doubleprotected static final intThe order of the expansions used.private static final intprivate static final intprivate final doubleprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final doubleUnderflow guard.private static final doubleprivate static final doubleIncrease multiplier in defn of TOl1 from 100 to 200 to fix inverse case 52.784459412564 0 -52.784459512563990912 179.634407464943777557private static final doubleprivate static final doubleCheck on bisection interval.static final GeodesicA global instantiation of Geodesic with the parameters for the WGS84 ellipsoid.private static final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static doublea1m1f(double eps) protected static doublea2m1f(double eps) private voida3coeff()protected doublea3f(double eps) arcDirect(double lat1, double lon1, double azi1, double a12) Solve the direct geodesic problem where the length of the geodesic is specified in terms of arc length.arcDirect(double lat1, double lon1, double azi1, double a12, int outmask) Solve the direct geodesic problem where the length of the geodesic is specified in terms of arc length and with a subset of the geodesic results returned.arcDirectLine(double lat1, double lon1, double azi1, double a12) Define aGeodesicLinein terms of the direct geodesic problem specified in terms of arc length with all capabilities included.arcDirectLine(double lat1, double lon1, double azi1, double a12, int caps) Define aGeodesicLinein terms of the direct geodesic problem specified in terms of arc length with a subset of the capabilities included.private static doubleastroid(double x, double y) protected static voidc1f(double eps, double[] c) protected static voidc1pf(double eps, double[] c) protected static voidc2f(double eps, double[] c) private voidc3coeff()protected voidc3f(double eps, double[] c) private voidc4coeff()protected voidc4f(double eps, double[] c) direct(double lat1, double lon1, double azi1, boolean arcmode, double s12A12, int outmask) The general direct geodesic problem.direct(double lat1, double lon1, double azi1, double s12) Solve the direct geodesic problem where the length of the geodesic is specified in terms of distance.direct(double lat1, double lon1, double azi1, double s12, int outmask) Solve the direct geodesic problem where the length of the geodesic is specified in terms of distance with a subset of the geodesic results returned.directLine(double lat1, double lon1, double azi1, double s12) Define aGeodesicLinein terms of the direct geodesic problem specified in terms of distance with all capabilities included.directLine(double lat1, double lon1, double azi1, double s12, int caps) Define aGeodesicLinein terms of the direct geodesic problem specified in terms of distance with a subset of the capabilities included.genDirectLine(double lat1, double lon1, double azi1, boolean arcmode, double s12A12, int caps) Define aGeodesicLinein terms of the direct geodesic problem specified in terms of either distance or arc length with a subset of the capabilities included.doubleTotal area of ellipsoid in meters2.doubleGets the flattening of the ellipsoid.doubleGets the equatorial radius of the ellipsoid (meters).inverse(double lat1, double lon1, double lat2, double lon2) Solve the inverse geodesic problem.inverse(double lat1, double lon1, double lat2, double lon2, int outmask) Solve the inverse geodesic problem with a subset of the geodesic results returned.private Geodesic.InverseDatainverseInt(double lat1, double lon1, double lat2, double lon2, int outmask) inverseLine(double lat1, double lon1, double lat2, double lon2) Define aGeodesicLinein terms of the inverse geodesic problem with all capabilities included.inverseLine(double lat1, double lon1, double lat2, double lon2, int caps) Define aGeodesicLinein terms of the inverse geodesic problem with a subet of the capabilities included.private Geodesic.InverseStartVinverseStart(double sbet1, double cbet1, double dn1, double sbet2, double cbet2, double dn2, double lam12, double slam12, double clam12, double[] c1a, double[] c2a) private Geodesic.Lambda12Vlambda12(double sbet1, double cbet1, double dn1, double sbet2, double cbet2, double dn2, double salp1, double calp1, double slam120, double clam120, boolean diffp, double[] c1a, double[] c2a, double[] c3a) private Geodesic.LengthsVlengths(double eps, double sig12, double ssig1, double csig1, double dn1, double ssig2, double csig2, double dn2, double cbet1, double cbet2, int outmask, double[] c1a, double[] c2a) line(double lat1, double lon1, double azi1) Set up to compute several points on a single geodesic with all capabilities included.line(double lat1, double lon1, double azi1, int caps) Set up to compute several points on a single geodesic with a subset of the capabilities included.private static GeodesicsafeInstance(double a, double f) Safely creates an ellipsoid with.protected static doublesinCosSeries(boolean sinp, double sinx, double cosx, double[] c) This is a reformulation of the geodesic problem.
-
Field Details
-
WGS84
A global instantiation of Geodesic with the parameters for the WGS84 ellipsoid. -
GEODESIC_ORDER
protected static final int GEODESIC_ORDERThe order of the expansions used.- See Also:
-
NA1
protected static final int NA1- See Also:
-
NC1
protected static final int NC1- See Also:
-
NC1P
protected static final int NC1P- See Also:
-
NA2
protected static final int NA2- See Also:
-
NC2
protected static final int NC2- See Also:
-
NA3
protected static final int NA3- See Also:
-
NA3X
protected static final int NA3X- See Also:
-
NC3
protected static final int NC3- See Also:
-
NC3X
protected static final int NC3X- See Also:
-
NC4
protected static final int NC4- See Also:
-
NC4X
protected static final int NC4X- See Also:
-
TINY
protected static final double TINYUnderflow guard. We require TINY * epsilon() < 0 and TINY + epsilon() == epsilon() -
MAXIT1
private static final int MAXIT1- See Also:
-
MAXIT2
private static final int MAXIT2- See Also:
-
TOL0
private static final double TOL0 -
TOL1
private static final double TOL1Increase multiplier in defn of TOl1 from 100 to 200 to fix inverse case 52.784459412564 0 -52.784459512563990912 179.634407464943777557 -
TOL2
private static final double TOL2 -
TOLB
private static final double TOLBCheck on bisection interval. -
XTHRESH
private static final double XTHRESH -
a
protected final double a -
f
protected final double f -
f1
protected final double f1 -
e2
protected final double e2 -
ep2
protected final double ep2 -
b
protected final double b -
c2
protected final double c2 -
n
private final double n -
etol2
private final double etol2 -
a3x
private final double[] a3x -
c3x
private final double[] c3x -
c4x
private final double[] c4x
-
-
Constructor Details
-
Geodesic
Constructor for an ellipsoid with.- Parameters:
a- equatorial radius (meters).f- flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.- Throws:
GeodesicException- if a or (1 − f) a is not positive.
-
-
Method Details
-
direct
Solve the direct geodesic problem where the length of the geodesic is specified in terms of distance. If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), and taking the limit ε → 0+. An arc length greater than 180° signifies a geodesic which is not the shortest path. (For a prolate ellipsoid, an additional condition is necessary for the shortest path: the longitudinal extent must not exceed of 180°.)- Parameters:
lat1- latitude of point 1 (degrees). lat1 should be in the range [−90°, 90°].lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).s12- distance between point 1 and point 2 (meters); it can be negative.- Returns:
- a
GeodesicDataobject with the following fields: lat1, lon1, azi1, lat2, lon2, azi2, s12, a12. The values of lon2 and azi2 returned are in the range [−180°, 180°].
-
direct
Solve the direct geodesic problem where the length of the geodesic is specified in terms of distance with a subset of the geodesic results returned.- Parameters:
lat1- latitude of point 1 (degrees).lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).s12- distance between point 1 and point 2 (meters); it can be negative.outmask- a bitor'ed combination ofGeodesicMaskvalues specifying which results should be returned.- Returns:
- a
GeodesicDataobject with the fields specified by outmask computed. lat1, lon1, azi1, s12, and a12 are always included in the returned result. The value of lon2 returned is in the range [−180°, 180°], unless the outmask includes theGeodesicMask.LONG_UNROLLflag.
-
arcDirect
Solve the direct geodesic problem where the length of the geodesic is specified in terms of arc length. If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), and taking the limit ε → 0+. An arc length greater than 180° signifies a geodesic which is not the shortest path. (For a prolate ellipsoid, an additional condition is necessary for the shortest path: the longitudinal extent must not exceed of 180°.)- Parameters:
lat1- latitude of point 1 (degrees). lat1 should be in the range [−90°, 90°].lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).a12- arc length between point 1 and point 2 (degrees); it can be negative.- Returns:
- a
GeodesicDataobject with the following fields: lat1, lon1, azi1, lat2, lon2, azi2, s12, a12. The values of lon2 and azi2 returned are in the range [−180°, 180°].
-
arcDirect
Solve the direct geodesic problem where the length of the geodesic is specified in terms of arc length and with a subset of the geodesic results returned.- Parameters:
lat1- latitude of point 1 (degrees).lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).a12- arc length between point 1 and point 2 (degrees); it can be negative.outmask- a bitor'ed combination ofGeodesicMaskvalues specifying which results should be returned.- Returns:
- a
GeodesicDataobject with the fields specified by outmask computed. lat1, lon1, azi1, and a12 are always included in the returned result. The value of lon2 returned is in the range [−180°, 180°], unless the outmask includes theGeodesicMask.LONG_UNROLLflag.
-
direct
public GeodesicData direct(double lat1, double lon1, double azi1, boolean arcmode, double s12A12, int outmask) The general direct geodesic problem.direct(double, double, double, double)andarcDirect(double, double, double, double)are defined in terms of this function. TheGeodesicMaskvalues possible for outmask are-
outmask |=
GeodesicMask.LATITUDEfor the latitude lat2; -
outmask |=
GeodesicMask.LONGITUDEfor the longitude lon2; -
outmask |=
GeodesicMask.AZIMUTHfor the azimuth azi2; -
outmask |=
GeodesicMask.DISTANCEfor the distance s12; -
outmask |=
GeodesicMask.REDUCED_LENGTHfor the reduced length m12; -
outmask |=
GeodesicMask.GEODESIC_SCALEfor the geodesic scales M12 and M21; -
outmask |=
GeodesicMask.AREAfor the area S12; -
outmask |=
GeodesicMask.LONG_UNROLL, if set then lon1 is unchanged and lon2 − lon1 indicates how many times and in what sense the geodesic encircles the ellipsoid. Otherwise lon1 and lon2 are both reduced to the range [−180°, 180°].
GeodesicMask.DISTANCEand arcmode is false, then s12 = s12A12. It is not necessary to includeGeodesicMask.DISTANCE_INin outmask; this is automatically included if arcmode is false.- Parameters:
lat1- latitude of point 1 (degrees).lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).arcmode- boolean flag determining the meaning of the s12A12.s12A12- arcmode is false, this is the distance between point 1 and point 2 (meters); otherwise it is the arc length between point 1 and point 2 (degrees); it can be negative.outmask- a bitor'ed combination ofGeodesicMaskvalues specifying which results should be returned.- Returns:
- a
GeodesicDataobject with the fields specified by outmask computed.
-
outmask |=
-
directLine
Define aGeodesicLinein terms of the direct geodesic problem specified in terms of distance with all capabilities included. This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem.- Parameters:
lat1- latitude of point 1 (degrees). lat1 should be in the range [−90°, 90°].lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).s12- distance between point 1 and point 2 (meters); it can be negative.- Returns:
- a
GeodesicLineobject.
-
directLine
Define aGeodesicLinein terms of the direct geodesic problem specified in terms of distance with a subset of the capabilities included. This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem.- Parameters:
lat1- latitude of point 1 (Degrees). lat1 should be in the range [−90°, 90°].lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).s12- distance between point 1 and point 2 (meters); it can be negative.caps- bitor'ed combination ofGeodesicMaskvalues specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls toGeodesicLine.position(double).- Returns:
- a
GeodesicLineobject.
-
arcDirectLine
Define aGeodesicLinein terms of the direct geodesic problem specified in terms of arc length with all capabilities included. This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem.- Parameters:
lat1- latitude of point 1 (degrees). lat1 should be in the range [−90°, 90°].lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).a12- arc length between point 1 and point 2 (degrees); it can be negative.- Returns:
- a
GeodesicLineobject.
-
arcDirectLine
Define aGeodesicLinein terms of the direct geodesic problem specified in terms of arc length with a subset of the capabilities included. This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem.- Parameters:
lat1- latitude of point 1 (degrees). lat1 should be in the range [−90°, 90°].lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).a12- arc length between point 1 and point 2 (degrees); it can be negative.caps- bitor'ed combination ofGeodesicMaskvalues specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls toGeodesicLine.position(double).- Returns:
- a
GeodesicLineobject.
-
genDirectLine
public GeodesicLine genDirectLine(double lat1, double lon1, double azi1, boolean arcmode, double s12A12, int caps) Define aGeodesicLinein terms of the direct geodesic problem specified in terms of either distance or arc length with a subset of the capabilities included. This function sets point 3 of the GeodesicLine to correspond to point 2 of the direct geodesic problem.- Parameters:
lat1- latitude of point 1 (degrees). lat1 should be in the range [−90°, 90°].lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).arcmode- boolean flag determining the meaning of the s12A12.s12A12- if arcmode is false, this is the distance between point 1 and point 2 (meters); otherwise it is the arc length between point 1 and point 2 (degrees); it can be negative.caps- bitor'ed combination ofGeodesicMaskvalues specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls toGeodesicLine.position(double).- Returns:
- a
GeodesicLineobject.
-
inverse
Solve the inverse geodesic problem. lat1 and lat2 should be in the range [−90°, 90°]. The values of azi1 and azi2 returned are in the range [−180°, 180°]. If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), taking the limit ε → 0+. The solution to the inverse problem is found using Newton's method. If this fails to converge (this is very unlikely in geodetic applications but does occur for very eccentric ellipsoids), then the bisection method is used to refine the solution.- Parameters:
lat1- latitude of point 1 (degrees).lon1- longitude of point 1 (degrees).lat2- latitude of point 2 (degrees).lon2- longitude of point 2 (degrees).- Returns:
- a
GeodesicDataobject with the following fields: lat1, lon1, azi1, lat2, lon2, azi2, s12, a12.
-
inverse
Solve the inverse geodesic problem with a subset of the geodesic results returned. TheGeodesicMaskvalues possible for outmask are-
outmask |=
GeodesicMask.DISTANCEfor the distance s12; -
outmask |=
GeodesicMask.AZIMUTHfor the latitude azi2. -
outmask |=
GeodesicMask.REDUCED_LENGTHfor the reduced length m12; -
outmask |=
GeodesicMask.GEODESIC_SCALEfor the geodesic scales M12 and M21; -
outmask |=
GeodesicMask.AREAfor the area S12; -
outmask |=
GeodesicMask.ALLfor all of the above. -
outmask |=
GeodesicMask.LONG_UNROLL, if set then lon1 is unchanged and lon2 − lon1 indicates whether the geodesic is east going or west going. Otherwise lon1 and lon2 are both reduced to the range [−180°, 180°].
- Parameters:
lat1- latitude of point 1 (degrees).lon1- longitude of point 1 (degrees).lat2- latitude of point 2 (degrees).lon2- longitude of point 2 (degrees)outmask- a bitor'ed combination ofGeodesicMaskvalues specifying which results should be returned.- Returns:
- a
GeodesicDataobject with the fields specified by outmask computed. lat1, lon1, lat2, lon2, and a12 are always included in the returned result.
-
outmask |=
-
inverseLine
Define aGeodesicLinein terms of the inverse geodesic problem with all capabilities included. This function sets point 3 of the GeodesicLine to correspond to point 2 of the inverse geodesic problem. lat2 and lat2 should be in the range [−90°, 90°].- Parameters:
lat1- latitude of point 1 (degrees).lon1- longitude of point 1 (degrees).lat2- latitude of point 2 (degrees).lon2- longitude of point 2 (degrees).- Returns:
- a
GeodesicLineobject.
-
inverseLine
Define aGeodesicLinein terms of the inverse geodesic problem with a subet of the capabilities included. This function sets point 3 of the GeodesicLine to correspond to point 2 of the inverse geodesic problem. lat1 and lat2 should be in the range [−90°, 90°].- Parameters:
lat1- latitude of point 1 (degrees).lon1- longitude of point 1 (degrees).lat2- latitude of point 2 (degrees).lon2- longitude of point 2 (degrees).caps- bitor'ed combination ofGeodesicMaskvalues specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls toGeodesicLine.position(double).- Returns:
- a
GeodesicLineobject.
-
line
Set up to compute several points on a single geodesic with all capabilities included. If the point is at a pole, the azimuth is defined by keeping the lon1 fixed, writing lat1 = ± (90 − ε), taking the limit ε → 0+.- Parameters:
lat1- latitude of point 1 (degrees). lat1 should be in the range [−90°, 90°].lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).- Returns:
- a
GeodesicLineobject. The full set of capabilities is included.
-
line
Set up to compute several points on a single geodesic with a subset of the capabilities included. TheGeodesicMaskvalues are:-
caps |=
GeodesicMask.LATITUDEfor the latitude lat2; this is added automatically; -
caps |=
GeodesicMask.LONGITUDEfor the longitude lon2; -
caps |=
GeodesicMask.AZIMUTHfor the azimuth azi2; this is added automatically; -
caps |=
GeodesicMask.DISTANCEfor the distance s12; -
caps |=
GeodesicMask.REDUCED_LENGTHfor the reduced length m12; -
caps |=
GeodesicMask.GEODESIC_SCALEfor the geodesic scales M12 and M21; -
caps |=
GeodesicMask.AREAfor the area S12; -
caps |=
GeodesicMask.DISTANCE_INpermits the length of the geodesic to be given in terms of s12; without this capability the length can only be specified in terms of arc length; -
caps |=
GeodesicMask.ALLfor all of the above.
- Parameters:
lat1- latitude of point 1 (degrees).lon1- longitude of point 1 (degrees).azi1- azimuth at point 1 (degrees).caps- bitor'ed combination ofGeodesicMaskvalues specifying which quantities can be returned in calls toGeodesicLine.position(double).- Returns:
- a
GeodesicLineobject.
-
caps |=
-
getMajorRadius
public double getMajorRadius()Gets the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.- Returns:
- a the equatorial radius of the ellipsoid (meters).
-
getFlattening
public double getFlattening()Gets the flattening of the ellipsoid. This is the value used in the constructor.- Returns:
- f the flattening of the ellipsoid.
-
getEllipsoidArea
public double getEllipsoidArea()Total area of ellipsoid in meters2. The area of a polygon encircling a pole can be found by adding ellipsoidArea()/2 to the sum of S12 for each side of the polygon.- Returns:
- total area of ellipsoid in meters2.
-
sinCosSeries
protected static double sinCosSeries(boolean sinp, double sinx, double cosx, double[] c) This is a reformulation of the geodesic problem. The notation is as follows: - at a general point (no suffix or 1 or 2 as suffix) - phi = latitude - beta = latitude on auxiliary sphere - omega = longitude on auxiliary sphere - lambda = longitude - alpha = azimuth of great circle - sigma = arc length along great circle - s = distance - tau = scaled distance (= sigma at multiples of pi/2) - at northwards equator crossing - beta = phi = 0 - omega = lambda = 0 - alpha = alpha0 - sigma = s = 0 - a 12 suggix means a difference, e.g., s12 = s2 - s1. - s and c prefixes mean sin and cos- Parameters:
sinp- sinus of psinx- sinus of xcosx- cosinus of xc- c- Returns:
- sin cos series.
-
a3f
protected double a3f(double eps) -
c3f
protected void c3f(double eps, double[] c) -
c4f
protected void c4f(double eps, double[] c) -
a1m1f
protected static double a1m1f(double eps) -
c1f
protected static void c1f(double eps, double[] c) -
c1pf
protected static void c1pf(double eps, double[] c) -
a2m1f
protected static double a2m1f(double eps) -
c2f
protected static void c2f(double eps, double[] c) -
a3coeff
private void a3coeff() -
c3coeff
private void c3coeff() -
c4coeff
private void c4coeff() -
inverseInt
private Geodesic.InverseData inverseInt(double lat1, double lon1, double lat2, double lon2, int outmask) -
safeInstance
Safely creates an ellipsoid with.- Parameters:
a- equatorial radius (meters).f- flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.- Returns:
- a new Geodesic instance or null if something fails.
-
lengths
private Geodesic.LengthsV lengths(double eps, double sig12, double ssig1, double csig1, double dn1, double ssig2, double csig2, double dn2, double cbet1, double cbet2, int outmask, double[] c1a, double[] c2a) -
astroid
private static double astroid(double x, double y) -
inverseStart
private Geodesic.InverseStartV inverseStart(double sbet1, double cbet1, double dn1, double sbet2, double cbet2, double dn2, double lam12, double slam12, double clam12, double[] c1a, double[] c2a) -
lambda12
private Geodesic.Lambda12V lambda12(double sbet1, double cbet1, double dn1, double sbet2, double cbet2, double dn2, double salp1, double calp1, double slam120, double clam120, boolean diffp, double[] c1a, double[] c2a, double[] c3a)
-