POV-Ray : Newsgroups : povray.advanced-users : Strange pigment error (3.6.1) : Re: Strange pigment error (3.6.1) Server Time
1 Jul 2024 06:17:57 EDT (-0400)
  Re: Strange pigment error (3.6.1)  
From: clipka
Date: 11 Sep 2009 06:21:41
Message: <4aaa24b5@news.povray.org>
SharkD schrieb:
> #local Temp_fnc1 = function {pigment {spherical}}
> #local Temp_fnc3 = function
> {
>     Temp_fnc1(x, log(y + 1) / log(2),z).gray
> }
> 
> The image actually *renders* most of the way. But about 3/4 done it 
> quits with the error, "Parse Error: Floating-point exception detected in 
> function 'Temp_fnc3'. Your function either attempted a division by zero, 
> used a function outside its domain or called an internal function with 
> invalid parameters."
> 
> Aren't parse errors supposed to occur *before* the image begins 
> rendering?

This is nothing that could be caught during parsing. After all, how is 
POV-Ray supposed to know whether or not the function will be called with 
parameters value that will cause one of the sub-expressions to operate 
on invalid operands?

For instance, if your function is

     function { 1 / (x+1) }

then how should POV-Ray know whether you will make sure it isn't called 
for any x smaller than -1?

 > How do I fix it?

The problem is most likely the subexpression

     log(y + 1)

which is undefined for any y <= -1. So make sure the pattern's native 
range of y <= -1 is always outside whatever object it is applied to.

Or clip the parameter to a safe range, e.g.:

     #local Temp_fnc3 = function
     {
         Temp_fnc1(x, log(max(0.0001,y+1)) / log(2),z).gray
     }

which forces the parameter for log() to be no smaller than 0.0001.


Post a reply to this message

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