|
Britbot
|
calculates distance (in turns) from ship's trajectory to a given island location (point) uses the calculation in calculation sheet 3
Definition at line 161 of file Navigator.cs. {
//first check if no direction
if (dir.NormSquared() == 0)
return Bot.Game.Distance(point, linePoint);
//TODO fix this - Matan Kom
//Find the difference vector between the point and the line point
HeadingVector dif = HeadingVector.CalcDifference(point, linePoint);
//find the minimum t parameter
double tMin = (-1 / dir.NormSquared()) * dir * dif;
//calculating actual distance (see calculation)
return (dif + tMin * dir).Norm();
;
}
|
1.7.6.1