27 lines
834 B
Python
27 lines
834 B
Python
import math
|
|
from logbook import Logger
|
|
|
|
from eos.graph import Graph
|
|
|
|
|
|
pyfalog = Logger(__name__)
|
|
|
|
|
|
class FitDistanceTimeGraph(Graph):
|
|
|
|
defaults = {"time": 0}
|
|
|
|
def __init__(self, fit, data=None):
|
|
Graph.__init__(self, fit, self.calcDistance, data if data is not None else self.defaults)
|
|
self.fit = fit
|
|
|
|
def calcDistance(self, data):
|
|
time = data["time"]
|
|
maxSpeed = self.fit.ship.getModifiedItemAttr('maxVelocity')
|
|
mass = self.fit.ship.getModifiedItemAttr('mass')
|
|
agility = self.fit.ship.getModifiedItemAttr('agility')
|
|
# Definite integral of:
|
|
# https://wiki.eveuniversity.org/Acceleration#Mathematics_and_formulae
|
|
distance = maxSpeed * time + (maxSpeed * agility * mass * math.exp((-time * 1000000) / (agility * mass)) / 1000000)
|
|
return distance
|