Correctifs pour POVRay

Section POV

Section POV - sous section correction

Blob, Classique

Suite à une discussion sur l'apparition des objets dans les versions de pov-ray, je suis tombé sur l'origine d'un autre bug du blob.
le bug classique du blob
de loinde près
Le problème est dû a une optimisation qui apparement n'est pas toujours juste.

Un correctif temporaire est le suivant:

*** source/blob.c.old   Fri May 11 18:57:23 2001
--- source/blob.c       Fri Sep  7 20:16:47 2001
***************
*** 504,504 ****
        }
      }
  
      /*
       * If the following intersection lies close to the current intersection
       * then first add/subtract next region before testing. [DB 7/94] 
       */
      if ((i + 1 < cnt) && (fabs(intervals[i].bound - intervals[i + 1].bound) < EPSILON))
      {
        continue;
--- 510,511 ----
        }
      }
  
+ #if 0
      /*
       * If the following intersection lies close to the current intersection
       * then first add/subtract next region before testing. [DB 7/94] 
       */
      if ((i + 1 < cnt) && (fabs(intervals[i].bound - intervals[i + 1].bound) < EPSILON))
      {
        continue;
***************
*** 546,546 ****
      {
        continue;
      }
! 
      /*
       * Now we could do bezier clipping to find the roots
       * but I have no idea how this works. [DB 2/95]
--- 553,553 ----
      {
        continue;
      }
! #endif
      /*
       * Now we could do bezier clipping to find the roots
       * but I have no idea how this works. [DB 2/95]
Il consiste à supprimer cette optimisation. Hélas, il vaudrait mieux réussir à corriger l'optimisation en la conservant, car les temps de calculs s'en ressentent et il devient souvent nécessaire d'ajout sturm dans le blob.
sans l'optimisation
sans sturmavec sturm

ENFIN

Massimo Valentini a trouvé le problème le 24 octobre 2002. C'était trois coefficients faux dans les calculs de l'optimisation (Encore fallait-il comprendre ces calculs: Bravo Massimo!).

La correction est très simple (maintenant que l'on sait!):

--- source/blob.c.old	Fri May 11 18:57:23 2001 
+++ source/blob.c	Wed Oct 30 19:10:18 2002
@@ -531,10 +530,10 @@
     /* Calculate coefficients of corresponding bezier curve. [DB 10/94] */
 
     dk[0] = newcoeffs[4];
     dk[1] = newcoeffs[4] + 0.25 * newcoeffs[3];
-    dk[2] = newcoeffs[4] + 0.50 * (newcoeffs[3] + newcoeffs[2] / 12.0);
-    dk[3] = newcoeffs[4] + 0.50 * (0.375 * newcoeffs[3] + newcoeffs[2] + 0.125 * newcoeffs[1]);
+    dk[2] = newcoeffs[4] + 0.50 * (newcoeffs[3] + newcoeffs[2] / 3.0);
+    dk[3] = newcoeffs[4] + 0.50 * (1.5 * newcoeffs[3] + newcoeffs[2] + 0.5 * newcoeffs[1]);
     dk[4] = newcoeffs[4] + newcoeffs[3] + newcoeffs[2] + newcoeffs[1] + newcoeffs[0];
 
     /*
      * Skip this interval if the ray doesn't intersect the convex hull of the

Section POV

Section POV - sous section correction