POV-Ray : Newsgroups : povray.unofficial.patches : SuperPatch / bad triangle : Re: SuperPatch / bad triangle Server Time
2 Sep 2024 20:19:40 EDT (-0400)
  Re: SuperPatch / bad triangle  
From: edna dornblazer
Date: 1 Jul 1999 13:17:23
Message: <377BA255.7E0@geocities.com>
edna dornblazer wrote:
> lighting.c and render.c are both from June 10.
> My trace says its crashing from Reflect()
[ ... ]

I think I found it.
In lighting.c, in Reflect():
    
    z = (FRAND() * 2) - 1;
    t = FRAND() * M_PI * 2;
    r = sqrt(1 - z*z);
Well, FRAND*2 (at least with MSDOS/DJGPP) on occasion returns 
numbers slightly bigger than 1.0, and the subsequent 
r=sqrt(negative number) yields NaN vectors a little later.
Replacing the r=sqrt() line with
     r = sqrt(fabs(1 - z*z));
at least lets that stupid triangle render.


Post a reply to this message

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