POV-Ray : Newsgroups : povray.programming : Set small values to 0. : Re: Set small values to 0. Server Time: 26 Oct 2020 13:47:02 GMT
  Re: Set small values to 0.  
From: DonF
Date: 30 Aug 2020 05:00:01
William F Pokorny <ano### [at] anonymousorg> wrote:

> Awaking this morning though, had a question in my head whether the above
> statement really true? I doubt you are really running v3.7 - or at least
> any official version of v3.7 because your output has the line:


The SPEC 2017 benchmark documentation indicates v3.7, but the SPEC code
itself is still documented as being version 3.6, as indicated from the
below comments from the quadrics.cpp. But it looks like a common issue
between 3.6 and 3.7, unless the issue is resolved elsewhere in the newer
version.


/****************************************************************************
 *               quadrics.cpp
 *
 * This module implements the code for the quadric shape primitive.
 *
 * from Persistence of Vision(tm) Ray Tracer version 3.6.
 * Copyright 1991-2003 Persistence of Vision Team
 * Copyright 2003-2009 Persistence of Vision Raytracer Pty. Ltd.
 *---------------------------------------------------------------------------
 * NOTICE: This source code file is provided so that users may experiment
 * with enhancements to POV-Ray and to port the software to platforms other
 * than those supported by the POV-Ray developers. There are strict rules
 * regarding how you are permitted to use this file. These rules are contained
 * in the distribution and derivative versions licenses which should have been
 * provided with this file.
 *
 * These licences may be found online, linked from the end-user license
 * agreement that is located at http://www.povray.org/povlegal.html
 *---------------------------------------------------------------------------
 * This program is based on the popular DKB raytracer version 2.12.
 * DKBTrace was originally written by David K. Buck.
 * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
 *---------------------------------------------------------------------------
 * $File: //depot/povray/spec-3.6/source/quadrics.cpp $
 * $Revision: #1 $
 * $Change: 5014 $
 * $DateTime: 2010/06/13 03:51:51 $
 * $Author: thorsten $
 * $Log$
 *****************************************************************************/


And once again, my simple fix, at least for the SPEC 2017 test case, was to
simply, rerun the "set small values to 0" check after the "recalculation".


 808   /* Get quadrics coefficients. */
 809
 810   A = Quadric->Square_Terms[X];
 811   E = Quadric->Square_Terms[Y];
 812   H = Quadric->Square_Terms[Z];
 813   B = Quadric->Mixed_Terms[X] / 2.0;
 814   C = Quadric->Mixed_Terms[Y] / 2.0;
 815   F = Quadric->Mixed_Terms[Z] / 2.0;
 816   D = Quadric->Terms[X] / 2.0;
 817   G = Quadric->Terms[Y] / 2.0;
 818   I = Quadric->Terms[Z] / 2.0;
 819   J = Quadric->Constant;
 820
 821   /* Set small values to 0. */
 822
 823   if (fabs(A) < EPSILON) A = 0.0;
 824   if (fabs(B) < EPSILON) B = 0.0;
 825   if (fabs(C) < EPSILON) C = 0.0;
 826   if (fabs(D) < EPSILON) D = 0.0;
 827   if (fabs(E) < EPSILON) E = 0.0;
 828   if (fabs(F) < EPSILON) F = 0.0;
 829   if (fabs(G) < EPSILON) G = 0.0;
 830   if (fabs(H) < EPSILON) H = 0.0;
 831   if (fabs(I) < EPSILON) I = 0.0;
 832   if (fabs(J) < EPSILON) J = 0.0;

 <skip some lines>

 893     /* Recalculate coefficients. */
 894
 895     D += A * T1[X];
 896     G += E * T1[Y];
 897     I += H * T1[Z];
 898     J -= T1[X]*(A*T1[X] + 2.0*D) + T1[Y]*(E*T1[Y] + 2.0*G) + T1[Z]*(H*T1[Z]
+ 2.0*I);

         /* Simple fix to redo the "set small values to 0." after
            the recalculation. */

         /* The SPEC 2017 case only needs this reset for J, but I
            assume it wouldn't hurt to redo for D, G, and I also.
            Also note that the J recalculation is different with the
            newer version of POVRAY, but that didn't change the
            "close to zero, but not actually equal to zero" issue.

         if (fabs(J) < EPSILON) J = 0.0;

 899   }


Post a reply to this message

Copyright 2003-2008 Persistence of Vision Raytracer Pty. Ltd.