|
Formula 1.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objecthirondelle.formula.function.builtin.Bearing
public final class Bearing
bearing(φ1, λ1, φ2, λ2): the compass bearing from one place to another.
Constructor Summary | |
---|---|
Bearing()
|
Method Summary | |
---|---|
Decimal |
calculate(Decimal... aArgs)
The bearing is the direction one must travel from a specific starting point (point 1) to get to a specific destination (point 2). |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bearing()
Method Detail |
---|
public Decimal calculate(Decimal... aArgs)
Returns degrees from true north, positive towards the east, in the range 0..360.
This method takes 4 parameters, in the following order:
Latitude is positive north of the equator, and negative south of the equator. Longitude is positive to the east of Greenwich meridian (Asia, for example), and negative to the west of the Greenwich meridian (America, for example).
The return value usually has a large number of decimal places. That precision is spurious and without physical significance, since the underlying implementation makes the approximation that the Earth is spherical.
The caller should round the result to a reasonable number of decimal places. (Some applications may even decide to round the result to an integer.)
For reference, the crux of the formula is:
atan2(sin(Δλ) * cos(φ2), cos(φ1) * sin(φ2) - sin(φ1) * cos(φ2) * cos(Δλ)
calculate
in interface Function
aArgs
- 0 or more arguments to the function.
|
Formula 1.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |