I realize that is it offtopic, but posting it here is the only place in the CO-community where math of this kind can be treated with importance.
You want me to make this relevant to CO? Gladly:
Code:
static double f2(double y, double x, int klimit)
{
if (x > 0)
return f(y / x, klimit);
else if (y >= 0 && x < 0)
return Math.PI + f(y / x, klimit);
else if (y < 0 && x < 0)
return (-Math.PI) + f(y / x, klimit);
else if (y > 0 && x == 0)
return Math.PI / 2;
else if (y < 0 && x == 0)
return (-Math.PI) / 2;
return Double.NaN;
}
Code:
static int GetAngle(int X1, int Y1, int X2, int Y2)
{
return (int)Math.Round(f2(Y2 - Y1, X2 - X1, 5) * 180 / Math.PI);
}
Used commonly to get the angle between two entities. You just didn't know (or better yet, you didn't have to know / understand) the math behind it but this calculation is likely used somewhere in your source, but the functions it depends on are likely being used from the .NET library instead of self-implemented. Knowing the angle is essential in calculating who gets it for the "wave" magic-type (named by TQ). Think about the poleaxe skill.