Copyright | (c) 2018 Cedric Liegeois |
---|---|
License | BSD3 |
Maintainer | Cedric Liegeois <ofmooseandmen@yahoo.fr> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
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
- data Track a = Track {
- trackPos :: a
- trackBearing :: Angle
- trackSpeed :: Speed
- data Course
- data Cpa a
- cpaTime :: Cpa a -> Duration
- cpaDistance :: Cpa a -> Length
- cpaPosition1 :: Cpa a -> a
- cpaPosition2 :: Cpa a -> a
- data Intercept a
- interceptTime :: Intercept a -> Duration
- interceptDistance :: Intercept a -> Length
- interceptPosition :: Intercept a -> a
- interceptorBearing :: Intercept a -> Angle
- interceptorSpeed :: Intercept a -> Speed
- course :: NTransform a => a -> Angle -> Course
- position :: NTransform a => Track a -> Duration -> Length -> a
- position84 :: NTransform a => Track a -> Duration -> a
- cpa :: (Eq a, NTransform a) => Track a -> Track a -> Length -> Maybe (Cpa a)
- cpa84 :: (Eq a, NTransform a) => Track a -> Track a -> Maybe (Cpa a)
- intercept :: (Eq a, NTransform a) => Track a -> a -> Length -> Maybe (Intercept a)
- intercept84 :: (Eq a, NTransform a) => Track a -> a -> Maybe (Intercept a)
- interceptBySpeed :: (Eq a, NTransform a) => Track a -> a -> Speed -> Length -> Maybe (Intercept a)
- interceptBySpeed84 :: (Eq a, NTransform a) => Track a -> a -> Speed -> Maybe (Intercept a)
- interceptByTime :: (Eq a, NTransform a) => Track a -> a -> Duration -> Length -> Maybe (Intercept a)
- interceptByTime84 :: (Eq a, NTransform a) => Track a -> a -> Duration -> Maybe (Intercept a)
The Track
type.
Track
represents the state of a vehicle by its current position, bearing and speed.
Track | |
|
Instances
Eq a => Eq (Track a) Source # | |
Show a => Show (Track a) Source # | |
(NTransform a, Show a) => IsGreatCircle (Track a) Source # |
|
Defined in Data.Geo.Jord.Kinematics greatCircle :: Track a -> GreatCircle Source # greatCircleE :: Track a -> Either String GreatCircle Source # greatCircleF :: MonadFail m => Track a -> m GreatCircle Source # |
The Course
type.
Course
represents the cardinal direction in which the vehicle is to be steered.
The Cpa
type.
Time to, and distance at, closest point of approach (CPA) as well as position of both tracks at 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.
Time, distance and position of intercept as well as speed and initial bearing of interceptor.
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.