geodetics-0.1.0: Terrestrial coordinate systems and geodetic calculations.

Safe HaskellNone
LanguageHaskell2010

Geodetics.Path

Description

The implementation assumes IEEE 754 arithmetic.

Synopsis

Documentation

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

Lower and upper exclusive bounds within which a path is valid.

data Path e Source #

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.

pathValidAt :: Path e -> Length Double -> Bool Source #

True if the path is valid at that distance.

bisect Source #

Arguments

:: 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.

intersect Source #

Arguments

:: Ellipsoid e 
=> Length Double 
-> Length Double

Starting estimates.

-> Length Double

Required accuracy.

-> Int

Iteration limit. Returns Nothing if this is reached.

-> 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.

rayPath Source #

Arguments

:: Ellipsoid e 
=> Geodetic e

Start point.

-> Angle Double

Bearing.

-> Angle Double

Elevation.

-> Path e 

A ray from a point heading in a straight line in 3 dimensions.

rhumbPath Source #

Arguments

:: Ellipsoid e 
=> Geodetic e

Start point.

-> Angle Double

Course.

-> Path e 

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.

latitudePath Source #

Arguments

:: Ellipsoid e 
=> Geodetic e

Start point.

-> Path e 

A path following the line of latitude around the Earth eastwards.

This is equivalent to rhumbPath pt (pi/2)

longitudePath Source #

Arguments

:: Ellipsoid e 
=> Geodetic e

Start point.

-> Path e 

A path from the specified point to the North Pole. Use negative distances for the southward path.

This is equivalent to rhumbPath pt _0