Safe Haskell | None |
---|---|

Language | Haskell2010 |

The implementation assumes IEEE 754 arithmetic.

## Synopsis

- type PathValidity = (Length Double, Length Double)
- data Path e = Path {
- pathFunc :: Length Double -> (Geodetic e, Angle Double, Angle Double)
- pathValidity :: PathValidity

- alwaysValid :: PathValidity
- pathValidAt :: Path e -> Length Double -> Bool
- bisect :: Path e -> (Geodetic e -> Ordering) -> Length Double -> Length Double -> Length Double -> Maybe (Length Double)
- intersect :: Ellipsoid e => Length Double -> Length Double -> Length Double -> Int -> Path e -> Path e -> Maybe (Length Double, Length Double)
- rayPath :: Ellipsoid e => Geodetic e -> Angle Double -> Angle Double -> Path e
- rhumbPath :: Ellipsoid e => Geodetic e -> Angle Double -> Path e
- latitudePath :: Ellipsoid e => Geodetic e -> Path e
- longitudePath :: Ellipsoid e => Geodetic e -> Path e

# Documentation

type PathValidity = (Length Double, Length Double) Source #

Lower and upper exclusive 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.

alwaysValid :: PathValidity Source #

Convenience value for paths that are valid for all distances.

:: Path e | |

-> (Geodetic e -> Ordering) | Evaluation function. |

-> Length Double | Required accuracy in terms of distance along the path. |

-> Length Double | |

-> Length Double | Initial bounds. |

-> Maybe (Length 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.

:: Ellipsoid e | |

=> Length Double | |

-> Length Double | Starting estimates. |

-> Length Double | Required accuracy. |

-> Int | Iteration limit. Returns |

-> Path e | |

-> Path e | Paths to intersect. |

-> Maybe (Length Double, Length 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)`