|
Britbot
|
this static method updates the direction based on the new one if the new direction is not to far from the one given (up to 90 degrees) it simply adds to the previous count vector otherwise, we assume there was a change in course and so we start again
Definition at line 142 of file HeadingVector.cs. {
//defining the result
HeadingVector newHv = new HeadingVector(hv1);
//if dot product is negative it means that the angle is bigger
// then 90 so it implies change in direction: reset count
//otherwise normal vector addition
//WOW math is useful
//I thought you HATED the applied math department
if (hv1 * hv2 < 0)
{
newHv = hv2;
} //also check that new direction isn't nothing
else if (hv2.Norm() == 0)
{
newHv = hv2;
}
else
{
newHv.X += hv2.X;
newHv.Y += hv2.Y;
}
//return the new heading vector
return newHv;
}
|
1.7.6.1