From 6ab79ab5c0cc9abd768cacc754e2c8a28790e64a Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Jul 2019 10:19:33 +0300 Subject: [PATCH] Fix angular speed calculation --- gui/builtinGraphs/fitDamageStats.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gui/builtinGraphs/fitDamageStats.py b/gui/builtinGraphs/fitDamageStats.py index 2994010ca..c9f5be3c3 100644 --- a/gui/builtinGraphs/fitDamageStats.py +++ b/gui/builtinGraphs/fitDamageStats.py @@ -428,11 +428,13 @@ def calculateAngularVelocity(atkSpeed, atkAngle, atkRadius, distance, tgtSpeed, atkAngle = atkAngle * math.pi / 180 tgtAngle = tgtAngle * math.pi / 180 ctcDistance = atkRadius + distance + tgtRadius - atkSpeedX = atkSpeed * math.cos(atkAngle) - atkSpeedY = atkSpeed * math.sin(atkAngle) - tgtSpeedX = tgtSpeed * math.cos(tgtAngle) - tgtSpeedY = tgtSpeed * math.sin(tgtAngle) - relSpeed = math.sqrt((atkSpeedX + tgtSpeedX) ** 2 + (atkSpeedY + tgtSpeedY) ** 2) + # Target is to the right of the attacker, so transversal is projection onto Y axis + transSpeed = abs(atkSpeed * math.sin(atkAngle) - tgtSpeed * math.sin(tgtAngle)) + if ctcDistance == 0: + angularSpeed = 0 if transSpeed == 0 else math.inf + else: + angularSpeed = transSpeed / ctcDistance + return angularSpeed def calculateRangeFactor(atkOptimalRange, atkFalloffRange, distance):