Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
roadway tracing
07-26-2006, 08:47 PM,
#7
 
joevenzon Wrote:However, my ray/bezier collision code seems to have some lingering bugs, and they cause the bumps you described. It may soon be time to audit the code and try to find what's causing the bug (I did this before and fixed ONE bug that was causing the bumps, but this second bug remains).

i think i found one of the sources of the bumpiness, IntersectQuadrilateralF() was trying to take the square root of a negative number and everything fell to pieces after that.

this patch:

Code:
--- src/utility.cpp     (revision 1162)
+++ src/utility.cpp     (working copy)
@@ -1143,6 +1143,7 @@
                  - (beta * (alpha_11 - (1.0))) - (1.0);
                float C = alpha;
                float D = (B * B) - ((4.0) * A * C);
+               if (D < 0) return false;
                float Q = (-0.5) * (B + ((B < (0.0) ? (-1.0) : (1.0))
                  * std::sqrt(D)));
                u = Q / A;
@@ -1250,6 +1251,7 @@
                  - (beta * (alpha_11 - (1.0))) - (1.0);
                double C = alpha;
                double D = (B * B) - ((4.0) * A * C);
+               if (D < 0) return false;
                double Q = (-0.5) * (B + ((B < (0.0) ? (-1.0) : (1.0))
                  * std::sqrt(D)));
                u = Q / A;
cured most of the problems.

i am running vdrift right not with fpe exceptions enabled so i get a core dump every time we raise an exception. this makes it pretty easy to find the problems. i can commit this to svn if you think it is correct.

--alex--
Reply


Messages In This Thread
roadway tracing - by alex25 - 07-25-2006, 03:16 PM
[No subject] - by alex25 - 07-25-2006, 03:49 PM
[No subject] - by thelusiv - 07-25-2006, 04:30 PM
[No subject] - by alex25 - 07-25-2006, 05:47 PM
[No subject] - by alex25 - 07-25-2006, 07:22 PM
[No subject] - by joevenzon_phpbb2_import3 - 07-26-2006, 01:32 AM
[No subject] - by alex25 - 07-26-2006, 08:47 PM
[No subject] - by joevenzon_phpbb2_import3 - 07-26-2006, 09:22 PM
[No subject] - by alex25 - 07-26-2006, 09:30 PM
[No subject] - by joevenzon_phpbb2_import3 - 08-02-2006, 09:31 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)