mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-30 17:36:27 +02:00
Fix direction; add scale computing.
This commit is contained in:
parent
197ee5c0ec
commit
8d8080181e
7 changed files with 133 additions and 55 deletions
|
@ -1,8 +1,20 @@
|
|||
class MinMax:
|
||||
"""
|
||||
Minimum and maximum.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.min_ = None
|
||||
self.max_ = None
|
||||
|
||||
def add(self, value):
|
||||
def update(self, value):
|
||||
"""
|
||||
Update minimum and maximum with new value.
|
||||
"""
|
||||
self.min_ = value if not self.min_ or value < self.min_ else self.min_
|
||||
self.max_ = value if not self.max_ or value > self.max_ else self.max_
|
||||
|
||||
def delta(self):
|
||||
"""
|
||||
Difference between maximum and minimum.
|
||||
"""
|
||||
return self.max_ - self.min_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue