POV-Ray : Newsgroups : povray.beta-test : initial_clock / final_clock behaviour : Re: initial_clock / final_clock behaviour Server Time
30 Jul 2024 00:28:20 EDT (-0400)
  Re: initial_clock / final_clock behaviour  
From: Rune
Date: 26 Mar 2002 07:24:43
Message: <3ca0688b@news.povray.org>
"Thorsten Froehlich" wrote:
> > Calculating a constant from a variable?? Come on,
> > this cries out for confusing precision errors!
>
> No, you are completely misunderstanding how
> floating-point precision works.

You must have misunderstood me.

My point is that calculating a constant such as initial_clock from a
variable such as clock will cause the constant to slightly change from frame
to frame even though you'd expect it to be 100% the same in every frame.

I can prove this.

Render the code below with the given command line settings.

// -ga +gd +gf +ki0.5 +kff9000

#declare Initial_Clock1 =
initial_clock;
#declare Initial_Clock2 =
clock - (frame_number - initial_frame) * clock_delta;
#declare Value1 = (Initial_Clock1-0.5)*100000;
#declare Value2 = (Initial_Clock2-0.5)*100000;
#declare Test1 = (Value1=0);
#declare Test2 = (Value2=0);
#debug concat(
   "Frame: ",str(frame_number,4,0),
   " - Value1: ",str(Value1,16,13),
   " - Value2: ",str(Value2,16,13),
   " - Test1: ",str(Test1,1,0),
   " - Test2: ",str(Test2,1,0),"\n"
)
#if (Test2=true)
   sphere {z,0.1 pigment {green 10}}
#else
   sphere {z,0.1 pigment {red 10}}
#end


I used beta 14 to test it and I hope you get the same results as I. I see
Value2 gain greater and greater precision errors from frame to frame, and
this ultimately causes a test to be true in some frames and false in others,
which is based directly on the calculated initial clock based on your
formulae. The initial clock provided directly by POV-Ray on the other hand
truly is the same in every frame.

This is why it's a very bad idea to calculate a constant from a variable,
and this is why I think the values initial_clock, final_clock, start_clock
and end_clock should be provided directly by POV-Ray and not in some
animation.inc file.

I'd like to hear your arguments against this.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:  http://rsj.mobilixnet.dk (updated Feb 16)
POV-Ray Users: http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Ring:  http://webring.povray.co.uk


Post a reply to this message

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