Hi, On Dienstag 31 Mai 2005 08:05, Mathias Fröhlich wrote: > Since I have to visit a customer today, I expect to find time tomorrow. > Sorry for that ... Just before any customer ...
Found a thinko. It worked for my testcases by accident. Attached ia a small patch not thought for application to CVS right now. It contains to the fix of that thinko some output which is triggered if the point in triangle test is less tolerant instead of more tolerant ... For all having problems here. Please test and tell me if you stil experience 1. this bug or 2. see this '########################' message on the screen while flying around. Have to leave now ... Greetings Mathias -- Mathias Fröhlich, email: [EMAIL PROTECTED]
Index: src/FDM/groundcache.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/groundcache.cxx,v retrieving revision 1.7 diff -u -r1.7 groundcache.cxx --- src/FDM/groundcache.cxx 30 May 2005 08:48:27 -0000 1.7 +++ src/FDM/groundcache.cxx 31 May 2005 06:55:41 -0000 @@ -131,7 +131,8 @@ SGDfloat tmp = (y2 - y3); SGDfloat tmpn = (x2 - x3); int side1 = SG_SIGN (tmp * (rx - x3) + (y3 - ry) * tmpn); - int side2 = SG_SIGN (tmp * (x1 - x3) + (y3 - side1*eps - y1) * tmpn); + int side2 = SG_SIGN (tmp * (x1 - x3) + (y3 - y1) * tmpn + + side1 * eps * fabs(tmpn)); if ( side1 != side2 ) { // printf("failed side 1 check\n"); return false; @@ -141,7 +142,8 @@ tmp = (y3 - ry); tmpn = (x3 - rx); side1 = SG_SIGN (tmp * (x2 - rx) + (ry - y2) * tmpn); - side2 = SG_SIGN (tmp * (x1 - rx) + (ry - side1*eps - y1) * tmpn); + side2 = SG_SIGN (tmp * (x1 - rx) + (ry - y1) * tmpn + + side1 * eps * fabs(tmpn)); if ( side1 != side2 ) { // printf("failed side 2 check\n"); return false; @@ -151,7 +153,8 @@ tmp = (y2 - ry); tmpn = (x2 - rx); side1 = SG_SIGN (tmp * (x3 - rx) + (ry - y3) * tmpn); - side2 = SG_SIGN (tmp * (x1 - rx) + (ry - side1*eps - y1) * tmpn); + side2 = SG_SIGN (tmp * (x1 - rx) + (ry - y1) * tmpn + + side1 * eps * fabs(tmpn)); if ( side1 != side2 ) { // printf("failed side 3 check\n"); return false; @@ -350,6 +353,8 @@ double this_radius = sgdLengthVec3(isectpoint); if (ground_radius < this_radius) ground_radius = this_radius; + } else if (sgdPointInTriangle( isectpoint, t.vertices )) { + SG_LOG(SG_FLIGHT,SG_ALERT, "############################"); } } } @@ -620,6 +625,9 @@ sgdVec3 isecpoint; if ( sgdIsectInfLinePlane( isecpoint, pt, dir, triangle.plane ) && sgdPointInTriangle( isecpoint, triangle.vertices ) ) { + if (!fgdPointInTriangle( isecpoint, triangle.vertices )) { + SG_LOG(SG_FLIGHT,SG_ALERT, "############################"); + } // Check for the closest intersection point. // FIXME: is this the right one?
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d