diff options
author | Tim Segers <tsegers@pm.me> | 2022-10-19 16:48:08 +0200 |
---|---|---|
committer | Tim Segers <tsegers@pm.me> | 2022-10-19 16:48:08 +0200 |
commit | 16d1b52543f73d972d33feaa94316dbb67ab907d (patch) | |
tree | 03c1934a0f3d13e9d45e5ab86223919214500fb3 /src/deco.c | |
parent | bc19593e867562f43f4c7ee0a367af3762eb22bd (diff) | |
download | opendeco-16d1b52543f73d972d33feaa94316dbb67ab907d.tar.gz |
Ascend along fixed stops instead of along rounded ceiling
Diffstat (limited to 'src/deco.c')
-rw-r--r-- | src/deco.c | 20 |
1 files changed, 3 insertions, 17 deletions
@@ -197,31 +197,17 @@ double get_gf(const decostate_t *ds, const double depth) const unsigned char lo = ds->gflo; const unsigned char hi = ds->gfhi; - const double last_stop_gauge = LAST_STOP_AT_SIX ? msw_to_bar(6) : ds->ceil_multiple; - if (ds->firststop == -1) return lo; - if (depth <= SURFACE_PRESSURE + last_stop_gauge) + if (depth <= SURFACE_PRESSURE) return hi; if (depth >= ds->firststop) return lo; /* interpolate lo and hi between first stop and last stop */ - return hi - (hi - lo) * gauge_depth(depth - ds->ceil_multiple) / gauge_depth(ds->firststop - ds->ceil_multiple); -} - -double round_ceiling(const decostate_t *ds, const double c) -{ - assert(ds->ceil_multiple != 0); - - double ceil_gauge = ds->ceil_multiple * ceil(RND(gauge_depth(c) / ds->ceil_multiple)); - - if (LAST_STOP_AT_SIX && ceil_gauge < msw_to_bar(6) && ceil_gauge > 0) - return abs_depth(msw_to_bar(6)); - else - return abs_depth(ceil_gauge); + return hi - (hi - lo) * gauge_depth(depth) / gauge_depth(ds->firststop); } double ceiling(const decostate_t *ds, double gf) @@ -249,7 +235,7 @@ double ceiling(const decostate_t *ds, double gf) c = max(c, ((pn2 + phe) - (a * gf)) / (gf / b + 1 - gf)); } - return round_ceiling(ds, c); + return c; } double gf99(const decostate_t *ds, double depth) |