jord-0.4.0.0: Geographical Position Calculations

Copyright(c) 2018 Cedric Liegeois
LicenseBSD3
MaintainerCedric Liegeois <ofmooseandmen@yahoo.fr>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Geo.Jord.Kinematics

Contents

Description

Types and functions for working with kinematics calculations assuming a spherical earth model.

All functions are implemented using the vector-based approached described in Gade, K. (2010). A Non-singular Horizontal Position Representation and in Shudde, Rex H. (1986). Some tactical algorithms for spherical geometry

Synopsis

The Track type.

data Track a Source #

Track represents the state of a vehicle by its current position, bearing and speed.

Constructors

Track 

Fields

Instances
Eq a => Eq (Track a) Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

Methods

(==) :: Track a -> Track a -> Bool #

(/=) :: Track a -> Track a -> Bool #

Show a => Show (Track a) Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

Methods

showsPrec :: Int -> Track a -> ShowS #

show :: Track a -> String #

showList :: [Track a] -> ShowS #

(NTransform a, Show a) => IsGreatCircle (Track a) Source #

GreatCircle from track.

Instance details

Defined in Data.Geo.Jord.Kinematics

The Course type.

data Course Source #

Course represents the cardinal direction in which the vehicle is to be steered.

Instances
Eq Course Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

Methods

(==) :: Course -> Course -> Bool #

(/=) :: Course -> Course -> Bool #

Show Course Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

IsVector3d Course Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

Methods

vec :: Course -> Vector3d Source #

The Cpa type.

data Cpa a Source #

Time to, and distance at, closest point of approach (CPA) as well as position of both tracks at CPA.

Instances
Eq a => Eq (Cpa a) Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

Methods

(==) :: Cpa a -> Cpa a -> Bool #

(/=) :: Cpa a -> Cpa a -> Bool #

Show a => Show (Cpa a) Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

Methods

showsPrec :: Int -> Cpa a -> ShowS #

show :: Cpa a -> String #

showList :: [Cpa a] -> ShowS #

cpaTime :: Cpa a -> Duration Source #

time to CPA.

cpaDistance :: Cpa a -> Length Source #

distance at CPA.

cpaPosition1 :: Cpa a -> a Source #

position of track 1 at CPA.

cpaPosition2 :: Cpa a -> a Source #

position of track 2 at CPA.

The Intercept type.

data Intercept a Source #

Time, distance and position of intercept as well as speed and initial bearing of interceptor.

Instances
Eq a => Eq (Intercept a) Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

Methods

(==) :: Intercept a -> Intercept a -> Bool #

(/=) :: Intercept a -> Intercept a -> Bool #

Show a => Show (Intercept a) Source # 
Instance details

Defined in Data.Geo.Jord.Kinematics

interceptTime :: Intercept a -> Duration Source #

time to intercept.

interceptDistance :: Intercept a -> Length Source #

distance at intercept.

interceptPosition :: Intercept a -> a Source #

position of intercept.

interceptorBearing :: Intercept a -> Angle Source #

initial bearing of interceptor.

interceptorSpeed :: Intercept a -> Speed Source #

speed of interceptor.

Calculations

course :: NTransform a => a -> Angle -> Course Source #

course p b computes the course of a vehicle currently at position p and following bearing b.

position :: NTransform a => Track a -> Duration -> Length -> a Source #

position t d r computes the position of a track t after duration d has elapsed and using the earth radius r.

    let p0 = latLongHeight (readLatLong "531914N0014347W") (metres 15000)
    let b = decimalDegrees 96.0217
    let s = kilometresPerHour 124.8
    let p1 = decimalLatLongHeight 53.1882691 0.1332741 (metres 15000)
    position (Track p0 b s) (hours 1) r84 = p1

position84 :: NTransform a => Track a -> Duration -> a Source #

position using the mean radius of the WGS84 reference ellipsoid.

cpa :: (Eq a, NTransform a) => Track a -> Track a -> Length -> Maybe (Cpa a) Source #

cpa t1 t2 r computes the closest point of approach between tracks t1 and t2 and using the earth radius r.

    let p1 = decimalLatLong 20 (-60)
    let b1 = decimalDegrees 10
    let s1 = knots 15
    let p2 = decimalLatLong 34 (-50)
    let b2 = decimalDegrees 220
    let s2 = knots 300
    let t1 = Track p1 b1 s1
    let t2 = Track p2 b2 s2
    let c = cpa t1 t2 r84
    fmap cpaTime c = Just (milliseconds 11396155)
    fmap cpaDistance c = Just (kilometres 124.2317453)

cpa84 :: (Eq a, NTransform a) => Track a -> Track a -> Maybe (Cpa a) Source #

cpa using the mean radius of the WGS84 reference ellipsoid.

intercept :: (Eq a, NTransform a) => Track a -> a -> Length -> Maybe (Intercept a) Source #

intercept t p r computes the minimum speed of interceptor at position p needed for an intercept with target track t to take place using the earth radius r. Intercept time, position, distance and interceptor bearing are derived from this minimum speed. Returns Nothing if intercept cannot be achieved e.g.:

  • interceptor and target are at the same position
  • interceptor is on the great circle of target and behind as the minimum speed would be target speed + epsillon
    let t = Track (decimalLatLong 34 (-50)) (decimalDegrees 220) (knots 600)
    let ip = (decimalLatLong 20 (-60))
    let i = intercept t ip r84
    fmap interceptorSpeed i = Just (knots 52.837096)
    fmap interceptTime i = Just (seconds 5947.698)

intercept84 :: (Eq a, NTransform a) => Track a -> a -> Maybe (Intercept a) Source #

intercept using the mean radius of the WGS84 reference ellipsoid.

interceptBySpeed :: (Eq a, NTransform a) => Track a -> a -> Speed -> Length -> Maybe (Intercept a) Source #

interceptBySpeed t p s r computes the time needed by interceptor at position p and travelling at speed s to intercept target track t using the earth radius r. Returns Nothing if intercept cannot be achieved e.g.:

  • interceptor and target are at the same position
  • interceptor speed is below minimum speed

interceptBySpeed84 :: (Eq a, NTransform a) => Track a -> a -> Speed -> Maybe (Intercept a) Source #

interceptBySpeed using the mean radius of the WGS84 reference ellipsoid.

interceptByTime :: (Eq a, NTransform a) => Track a -> a -> Duration -> Length -> Maybe (Intercept a) Source #

interceptByTime t p d r computes the speed of interceptor at position p needed for an intercept with target track t to take place after duration d and using the earth radius r. Returns Nothing if given duration is <= 0 or interceptor and target are at the same position.

    let t = Track (decimalLatLong 34 (-50)) (decimalDegrees 220) (knots 600)
    let ip = (decimalLatLong 20 (-60))
    let d = seconds 2700
    let i = interceptByTime t ip d r84
    fmap interceptorSpeed i = Just (knots 730.959238)
    fmap interceptorBearing i = Just (decimalDegrees 26.1199030)
    fmap interceptPosition i = Just (decimalLatLong 28.1366797 (-55.4559475))
    fmap interceptDistance i = Just (metres 1015302.3815)
    fmap interceptTime i = Just (seconds 2700)

interceptByTime84 :: (Eq a, NTransform a) => Track a -> a -> Duration -> Maybe (Intercept a) Source #

interceptByTime using the mean radius of the WGS84 reference ellipsoid.