if(velocity >= 0 && distanceRemaining >= decelDistance(velocity)) |
double maxTurn = Math.PI/180*(10 - 0.75*Math.abs(velocity)); theta = limit(0,theta - maxTurn, Math.PI/2); if(velocity >= 0 && distanceRemaining > decelDistance(velocity)) |
|
double maxTurn = Math.PI/180*(10 - 0.75*velocity); theta = limit(0,theta - maxTurn, Math.PI/2); |
else //rule of cosines |
else{ //rule of cosines double oldDistRem? = distanceRemaining; |
double acosVal = (velocity*velocity + distanceRemaining*distanceRemaining - oldDistRem?*oldDistRem?)/(2*velocity*distanceRemaining); if(Math.abs(acosVal) <= 1){ theta = Math.abs(Math.acos(acosVal)); if(theta > Math.PI/2) theta = Math.PI - theta; } } |
}while(time < timeAvailable && distanceRemaining >= 1); |
}while(time < timeAvailable && distanceRemaining > 0.000001); |