diff options
author | willemferguson <willemferguson@zoology.up.ac.za> | 2019-04-30 12:42:33 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-05-15 07:37:14 -0700 |
commit | 1bdf00b2b472078a0b24f1c269782d822cb96e02 (patch) | |
tree | 13a5e784118d9abb0a1bc1dfa9cbe4a9f457de80 /core/units.h | |
parent | ca6aa3813956b5e8be68b86ed36a5786b3ee746f (diff) | |
download | subsurface-1bdf00b2b472078a0b24f1c269782d822cb96e02.tar.gz |
Convert the atmospheric pressure in the Information Tab to an editable field
The Information tab shows the atmospheric pressure. Make this value editable
and also ensure that changes to it are undo-able.
Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
Diffstat (limited to 'core/units.h')
-rw-r--r-- | core/units.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/units.h b/core/units.h index c9920ac14..2307622e9 100644 --- a/core/units.h +++ b/core/units.h @@ -254,6 +254,17 @@ static inline int mbar_to_PSI(int mbar) return to_PSI(p); } +static inline int32_t altitude_to_pressure(int32_t altitude) // altitude in mm above sea level +{ // returns atmospheric pressure in mbar + return (int32_t) (1013.0 * exp(- altitude / 7800000.0)); +} + + +static inline int32_t pressure_to_altitude(int32_t pressure) // pressure in mbar +{ // returns altitude in mm above sea level + return (int32_t) (log(1013.0 / pressure) * 7800000); +} + /* * We keep our internal data in well-specified units, but * the input and output may come in some random format. This |