POV-Ray : Newsgroups : povray.programming : Re: I found a bug in povray source code 3.6... Take a look... Server Time
22 Dec 2024 12:34:19 EST (-0500)
  Re: I found a bug in povray source code 3.6... Take a look... (Message 1 to 1 of 1)  
From: Wolfgang Wieser
Subject: Re: I found a bug in povray source code 3.6... Take a look...
Date: 18 Oct 2004 17:04:43
Message: <41742fea@news.povray.org>
(Sorry for not quoting correctly but the message has already expired on my 
local box.)

It seems _somebody_ has to do it: I developed a test scene to demonstrate 
the index copy-n-paste typo bug described in the quoted message below 
(one month ago). 

Details (including 2 images) can be found here: 
http://www.cip.physik.uni-muenchen.de/~wwieser/render/povray/patches/ww-bugfix/index.html#bezier

Wolfgang

-----------------<Original message>-----------------
I think to have found some bugs in povray's source code version 3.6 (should
be the latest). More precisely, I found a problem in the way you compute
normal for a bezier patch (file: bezier.cpp). To say the truth, I think
that it's only a typo, but however... :)

Take a look at the following function (cut & pasted from bezier.cpp):

static DBL determine_subpatch_flatness(VECTOR (*Patch)[4][4])
{
  int i, j;
  DBL d, dist, temp1;
  VECTOR n, TempV;
  VECTOR vertices[4];

  Assign_Vector(vertices[0], (*Patch)[0][0]);
  Assign_Vector(vertices[1], (*Patch)[0][3]);

  VSub(TempV, vertices[0], vertices[1]);

  VLength(temp1, TempV);

  if (fabs(temp1) < EPSILON)
  {
    /*
     * Degenerate in the V direction for U = 0. This is ok if the other
     * two corners are distinct from the lower left corner - I'm sure there
     * are cases where the corners coincide and the middle has good values,
     * but that is somewhat pathalogical and won't be considered.
     */

    Assign_Vector(vertices[1], (*Patch)[3][3]);

    VSub(TempV, vertices[0], vertices[1]);

    VLength(temp1, TempV);

    if (fabs(temp1) < EPSILON)
    {
      return (-1.0);
    }

    Assign_Vector(vertices[2], (*Patch)[3][0]);

    VSub(TempV, vertices[0], vertices[1]);
                                      ^
                                      +---- WRONG!!! Should be: vertices[2],
isn't it?

    VLength(temp1, TempV);

    if (fabs(temp1) < EPSILON)
    {
      return (-1.0);
    }

    VSub(TempV, vertices[1], vertices[2]);

    VLength(temp1, TempV);

    if (fabs(temp1) < EPSILON)
    {
      return (-1.0);
    }
  }
  else
  {
    Assign_Vector(vertices[2], (*Patch)[3][0]);

    VSub(TempV, vertices[0], vertices[1]);
                                      ^
                                      +---- SAME ERROR HERE!!! Should be:
vertices[2]...
    .
    .
}

What you think about it?

Bye,

- Gianluca Arcidiacono (a.k.a. AGPX)


Post a reply to this message

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