Mathias Frhlich:
I have now fixed the problem that flying below bridges was broken by some groundcache work.
This commit is contained in:
parent
7f3cd89be5
commit
171a93869b
1 changed files with 22 additions and 15 deletions
|
@ -356,6 +356,12 @@ FGGroundCache::putSurfaceLeafIntoCache(const sgdSphere *sp,
|
|||
sgdVec3 isectpoint;
|
||||
if ( sgdIsectInfLinePlane( isectpoint, tmp, down, t.plane ) &&
|
||||
fgdPointInTriangle( isectpoint, t.vertices ) ) {
|
||||
// Compute the offset to the ground cache midpoint
|
||||
sgdVec3 off;
|
||||
sgdSubVec3(off, isectpoint, tmp);
|
||||
// Only accept the altitude if the intersection point is below the
|
||||
// ground cache midpoint
|
||||
if (0 < sgdScalarProductVec3( off, down ) || !found_ground) {
|
||||
found_ground = true;
|
||||
sgdAddVec3(isectpoint, cache_center);
|
||||
double this_radius = sgdLengthVec3(isectpoint);
|
||||
|
@ -364,6 +370,7 @@ FGGroundCache::putSurfaceLeafIntoCache(const sgdSphere *sp,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -650,16 +657,16 @@ FGGroundCache::get_agl(double t, const double dpt[3], double max_altoff,
|
|||
sgdVec3 isecpoint;
|
||||
if ( sgdIsectInfLinePlane( isecpoint, pt, dir, triangle.plane ) &&
|
||||
sgdPointInTriangle( isecpoint, triangle.vertices ) ) {
|
||||
// Compute the vector from pt to the intersection point ...
|
||||
sgdVec3 off;
|
||||
sgdSubVec3(off, isecpoint, pt);
|
||||
// ... and check if it is too high or not
|
||||
if (-max_altoff < sgdScalarProductVec3( off, dir )) {
|
||||
// Transform to the wgs system
|
||||
sgdAddVec3( isecpoint, cache_center );
|
||||
// compute the radius, good enough approximation to take the geocentric radius
|
||||
SGDfloat radius = sgdLengthSquaredVec3(isecpoint);
|
||||
if (current_radius < radius) {
|
||||
// Compute the vector from pt to the intersection point ...
|
||||
sgdVec3 off;
|
||||
sgdSubVec3(off, pt, isecpoint);
|
||||
// ... and check if it is too high or not
|
||||
if (-max_altoff < sgdScalarProductVec3( off, dir )) {
|
||||
current_radius = radius;
|
||||
ret = true;
|
||||
// Save the new potential intersection point.
|
||||
|
|
Loading…
Reference in a new issue