Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Geodetics.Path
Description
The implementation assumes IEEE 754 arithmetic.
Synopsis
- type PathValidity = (Double, Double)
- data Path e = Path {
- pathFunc :: Double -> (Geodetic e, Double, Double)
- pathValidity :: PathValidity
- alwaysValid :: PathValidity
- pathValidAt :: Path e -> Double -> Bool
- bisect :: Path e -> (Geodetic e -> Ordering) -> Double -> Double -> Double -> Maybe Double
- intersect :: Ellipsoid e => Double -> Double -> Double -> Int -> Path e -> Path e -> Maybe (Double, Double)
- rayPath :: Ellipsoid e => Geodetic e -> Double -> Double -> Path e
- rhumbPath :: Ellipsoid e => Geodetic e -> Double -> Path e
- latitudePath :: Ellipsoid e => Geodetic e -> Path e
- longitudePath :: Ellipsoid e => Geodetic e -> Path e
Documentation
type PathValidity = (Double, Double) Source #
Lower and upper exclusive distance bounds within which a path is valid.
A path is a parametric function of distance along the path. The result is the position, and the direction of the path at that point as heading and elevation angles.
A well-behaved path must be continuous and monotonic (that is, if the distance increases then the result is further along the path) for all distances within its validity range. Ideally the physical distance along the path from the origin to the result should be equal to the argument. If this is not practical then a reasonably close approximation may be used, such as a spheroid instead of an ellipsoid, provided that this is documented. Outside its validity the path function may return anything or bottom.
Constructors
Path | |
Fields
|
alwaysValid :: PathValidity Source #
Convenience value for paths that are valid for all distances.
Arguments
:: Path e | |
-> (Geodetic e -> Ordering) | Evaluation function. |
-> Double | Required accuracy in terms of distance along the path. |
-> Double | |
-> Double | Initial bounds. |
-> Maybe Double |
Find where a path meets a given condition using bisection. This is not the most efficient algorithm, but it will always produce a result if there is one within the initial bounds. If there is more than one result then an arbitrary one will be returned.
The initial bounds must return one GT or EQ value and one LT or EQ value. If they
do not then Nothing
is returned.
Arguments
:: Ellipsoid e | |
=> Double | |
-> Double | Starting estimates. |
-> Double | Required accuracy. |
-> Int | Iteration limit. Returns |
-> Path e | |
-> Path e | Paths to intersect. |
-> Maybe (Double, Double) |
Try to find the intersection point of two ground paths (i.e. ignoring altitude). Returns the distance of the intersection point along each path using a modified Newton-Raphson method. If the two paths are fairly straight and not close to parallel then this will converge rapidly.
The algorithm projects great-circle paths forwards using the bearing at the estimate to find the estimated intersection, and then uses the distances to this intersection as the next estimates.
If either estimate departs from its path validity then Nothing
is returned.
A ray from a point heading in a straight line in 3 dimensions.
Rhumb line: path following a constant course. Also known as a loxodrome.
The valid range stops a few arc-minutes short of the poles to ensure that the polar singularities are not included. Anyone using a rhumb line that close to a pole must be going round the twist anyway.
Based on Practical Sailing Formulas for Rhumb-Line Tracks on an Oblate Earth by G.H. Kaplan, U.S. Naval Observatory. Except for points close to the poles the approximation is accurate to within a few meters over 1000km.
A path following the line of latitude around the Earth eastwards.
This is equivalent to rhumbPath pt (pi/2)