diff options
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] |