Prevent two possible nan's
This commit is contained in:
parent
d6c5dc647d
commit
335fda719d
2 changed files with 9 additions and 2 deletions
|
@ -503,7 +503,11 @@ FGTrim::RotationParameters FGTrim::calcRotation(vector<ContactPoints>& contacts,
|
|||
double DistPlane = d0 * DotProduct(u, iter->normal) / length;
|
||||
// The coordinate of the point of intersection 'P' between the circle and
|
||||
// the ground is (0, DistPlane, alpha) in the basis (u, v, t)
|
||||
double alpha = sqrt(sqrRadius - DistPlane * DistPlane);
|
||||
double mag = sqrRadius - DistPlane * DistPlane;
|
||||
if (mag < 0) {
|
||||
cout << "FGTrim::calcRotation DistPlane^2 larger than sqrRadius" << endl;
|
||||
}
|
||||
double alpha = sqrt(max(mag, 0.0));
|
||||
FGColumnVector3 CP = alpha * t + DistPlane * v;
|
||||
// The transformation is now constructed: we can extract the angle using the
|
||||
// classical formulas (cosine is obtained from the dot product and sine from
|
||||
|
|
|
@ -652,7 +652,10 @@ double FGAISchedule::getSpeed()
|
|||
double dist = SGGeodesy::distanceNm(dep->geod(), arr->geod());
|
||||
double remainingTimeEnroute = (*i)->getArrivalTime() - (*i)->getDepartureTime();
|
||||
|
||||
double speed = dist / (remainingTimeEnroute/3600.0);
|
||||
double speed = 0.0;
|
||||
if (remainingTimeEnroute > 0.01)
|
||||
speed = dist / (remainingTimeEnroute/3600.0);
|
||||
|
||||
SG_CLAMP_RANGE(speed, 300.0, 500.0);
|
||||
return speed;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue