local z=_Tune.Horsepower/100 local i=(((_Tune.Horsepower*(_TPsi*(_Tune.T_Efficiency/10)))/7.5)/2)/100 local P=(((_Tune.Horsepower*(_SPsi*(_Tune.S_Efficiency/10)))/7.5)/2)/100 local J=_Tune.PeakRPM/1000 local L=_Tune.PeakSharpness local Q=_Tune.CurveMult local m=_Tune.EqPoint/1000 function CurveN(i)i=i/1000 return(-(i-J)^2*math.min(z/J^2,Q^(J/z))+z)*(i-i^L/(L*J^(L-1)))end local F=CurveN(_Tune.PeakRPM)function CurveT(z)z=z/1000 return(-(z-J)^2*math.min(i/J^2,Q^(J/i))+i)*(z-z^L/(L*J^(L-1)))end local A=CurveT(_Tune.PeakRPM)function CurveS(z)z=z/1000 return(-(z-J)^2*math.min(P/J^2,Q^(J/P))+P)*(z-z^L/(L*J^(L-1)))end local R=CurveS(_Tune.PeakRPM)


local HP=_Tune.Horsepower/100
local HP_T=((_Tune.Horsepower*((_TPsi)*(_Tune.T_Efficiency/10))/7.5)/2)/100
local HP_S=((_Tune.Horsepower*((_SPsi)*(_Tune.S_Efficiency/10))/7.5)/2)/100

local Peak=_Tune.PeakRPM/1000
local Sharpness=_Tune.PeakSharpness
local CurveMult=_Tune.CurveMult
local EQ=_Tune.EqPoint/1000

function CurveN(RPM)
	RPM=RPM/1000
	return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveN = CurveN(_Tune.PeakRPM)

function CurveT(RPM)
	RPM=RPM/1000
	return ((-(RPM-Peak)^2)*math.min(HP_T/(Peak^2),CurveMult^(Peak/HP_T))+HP_T)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveT = CurveT(_Tune.PeakRPM)

function CurveS(RPM)
	RPM=RPM/1000
	return ((-(RPM-Peak)^2)*math.min(HP_S/(Peak^2),CurveMult^(Peak/HP_S))+HP_S)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveS = CurveS(_Tune.PeakRPM)
