diff options
author | Aki <please@ignore.pl> | 2022-09-03 00:41:49 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-09-03 00:41:49 +0200 |
commit | 222bc58e3b51a70e95e15fe4681d50809f54c50a (patch) | |
tree | 14a6bc7409708a3efbf17b868b42fcf36339d855 /szilagyi/nomogram.py | |
parent | 6a5f689cf6acfc0ad99134a8e65854f8a8aa1774 (diff) | |
download | szilagyi-222bc58e3b51a70e95e15fe4681d50809f54c50a.zip szilagyi-222bc58e3b51a70e95e15fe4681d50809f54c50a.tar.gz szilagyi-222bc58e3b51a70e95e15fe4681d50809f54c50a.tar.bz2 |
Moved all calculation logic to nomogram
Diffstat (limited to 'szilagyi/nomogram.py')
-rw-r--r-- | szilagyi/nomogram.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/szilagyi/nomogram.py b/szilagyi/nomogram.py index 299d930..55276ae 100644 --- a/szilagyi/nomogram.py +++ b/szilagyi/nomogram.py @@ -1,7 +1,7 @@ import math from collections import deque -from ._dataset import Vector +from . import _dataset def look_downwards(data, x, start): @@ -61,10 +61,9 @@ def find_boundary_curves(swis, x, y): return segments -def calculate_swi(segments, x, y): - vec = Vector(x, y) - low = segments[0] - high = segments[1] +def calculate_swi(x, y): + low, high = find_boundary_curves(_dataset.INDICES, x, y) + vec = _dataset.Vector(x, y) dist_to_low = min(abs(vec - p) for p in (low[1][low[2]], low[1][low[2]])) dist_to_high = min(abs(vec - p) for p in (high[1][high[2]], high[1][high[2]])) return dist_to_low / (dist_to_low + dist_to_high) * (high[0] - low[0]) + low[0] |