Skip to content

Commit

Permalink
Add arealVelocity
Browse files Browse the repository at this point in the history
  • Loading branch information
expipiplus1 committed Nov 29, 2015
1 parent ed26f8e commit 8a5d3b0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Physics/Orbit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ module Physics.Orbit
, apoapsis
, meanMotion
, period
, arealVelocity
-- *** Geometry
, semiMajorAxis
, semiMinorAxis
, semiLatusRectum
Expand Down Expand Up @@ -292,3 +294,17 @@ hyperbolicDepartureAngle o =
-- and -π when given a parabolic orbit.
hyperbolicApproachAngle :: (Floating a, Ord a) => Orbit a -> Maybe (Angle a)
hyperbolicApproachAngle = fmap negate' . hyperbolicDepartureAngle

-- | Calculate the areal velocity, A, of the orbit.
--
-- The areal velocity is the area <https://xkcd.com/21/ swept out> by the line
-- between the orbiting body and the primary per second.
arealVelocity :: (Ord a, Floating a) => Orbit a -> Quantity a [u|m^2/s|]
arealVelocity o = case classify o of
Elliptic -> sqrt' (μ *: a *: (1 + e) /: (1 - e))
Parabolic -> sqrt' (μ *: q /: 2)
Hyperbolic -> sqrt' (μ *: (negate' a) *: (1 + e) /: (1 - e))
where μ = primaryGravitationalParameter o
Just a = semiMajorAxis o
e = eccentricity o
q = periapsis o

0 comments on commit 8a5d3b0

Please sign in to comment.