|
Britbot
|
This function should solve equation (*) in calculation sheet 2 I am not sure if this works, the solution was annoying as hell, hope i did everything right.
Definition at line 122 of file Navigator.cs. {
//TODO fix this
int[] signs = {-1, 1};
//there are 4 options, going over them 2 by 2
for (int i = 0; i <= 1; i++) //i is the sign of c in r
{
int cSign = signs[i];
for (int j = 0; j <= 1; j++) //j is the sign of e in r
{
int eSign = signs[j];
double r = -(cSign * b + eSign * d) / (a + cSign * c + eSign * e);
//check if r isn't positive, if so we can skip it
if (r <= 0)
continue;
//else check the critirions
if ((cSign * c * r <= -cSign * b) && (eSign * e * r <= -eSign * d))
{
//it is (probably?) the correct r
return r;
}
}
}
//if we are here then i am wrong :)
Logger.Write("MATAN K IS AN IDIOT");
return 1;
}
|
1.7.6.1