1
0
Fork 0

Mathias Frhlich:

I have now fixed the problem that flying below bridges was broken by some
groundcache work.
This commit is contained in:
ehofman 2005-11-04 14:49:15 +00:00
parent 7f3cd89be5
commit 171a93869b

View file

@ -356,11 +356,18 @@ FGGroundCache::putSurfaceLeafIntoCache(const sgdSphere *sp,
sgdVec3 isectpoint; sgdVec3 isectpoint;
if ( sgdIsectInfLinePlane( isectpoint, tmp, down, t.plane ) && if ( sgdIsectInfLinePlane( isectpoint, tmp, down, t.plane ) &&
fgdPointInTriangle( isectpoint, t.vertices ) ) { fgdPointInTriangle( isectpoint, t.vertices ) ) {
found_ground = true; // Compute the offset to the ground cache midpoint
sgdAddVec3(isectpoint, cache_center); sgdVec3 off;
double this_radius = sgdLengthVec3(isectpoint); sgdSubVec3(off, isectpoint, tmp);
if (ground_radius < this_radius) // Only accept the altitude if the intersection point is below the
ground_radius = this_radius; // ground cache midpoint
if (0 < sgdScalarProductVec3( off, down ) || !found_ground) {
found_ground = true;
sgdAddVec3(isectpoint, cache_center);
double this_radius = sgdLengthVec3(isectpoint);
if (ground_radius < this_radius)
ground_radius = this_radius;
}
} }
} }
} }
@ -650,16 +657,16 @@ FGGroundCache::get_agl(double t, const double dpt[3], double max_altoff,
sgdVec3 isecpoint; sgdVec3 isecpoint;
if ( sgdIsectInfLinePlane( isecpoint, pt, dir, triangle.plane ) && if ( sgdIsectInfLinePlane( isecpoint, pt, dir, triangle.plane ) &&
sgdPointInTriangle( isecpoint, triangle.vertices ) ) { sgdPointInTriangle( isecpoint, triangle.vertices ) ) {
// Transform to the wgs system // Compute the vector from pt to the intersection point ...
sgdAddVec3( isecpoint, cache_center ); sgdVec3 off;
// compute the radius, good enough approximation to take the geocentric radius sgdSubVec3(off, isecpoint, pt);
SGDfloat radius = sgdLengthSquaredVec3(isecpoint); // ... and check if it is too high or not
if (current_radius < radius) { if (-max_altoff < sgdScalarProductVec3( off, dir )) {
// Compute the vector from pt to the intersection point ... // Transform to the wgs system
sgdVec3 off; sgdAddVec3( isecpoint, cache_center );
sgdSubVec3(off, pt, isecpoint); // compute the radius, good enough approximation to take the geocentric radius
// ... and check if it is too high or not SGDfloat radius = sgdLengthSquaredVec3(isecpoint);
if (-max_altoff < sgdScalarProductVec3( off, dir )) { if (current_radius < radius) {
current_radius = radius; current_radius = radius;
ret = true; ret = true;
// Save the new potential intersection point. // Save the new potential intersection point.