POV-Ray : Newsgroups : povray.beta-test : bug: select within select : Re: select within select Server Time
30 Jul 2024 20:25:14 EDT (-0400)
  Re: select within select  
From: Slime
Date: 1 Oct 2001 12:29:07
Message: <3bb899d3$1@news.povray.org>
Well, for them to appear *evenly*, you would have to change the (1/2) to
(2/3). But it's a mystery to me as to why zero isn't appearing.

Just wanted to clarify that they shouldn't appear completely evenly.

- Slime
[ http://www.teja.nu/slime/ ]
[ http://www.teja.nu/slime/images/ ]


news:j60hrt43df8pu3ugq4hk6dvqqo4pod61rr@4ax.com...
> POV 3.5b4 on PII233 128 MB with NT4Sp6
>
> it looks like select inside select not work
>
> look at the function
>
> #local test=function{
>         select(
>           f_noise3d(floor(x),floor(y),0)-(1/3),
>           0,
>           select(
>             f_noise3d(floor(y),floor(x),0)-(1/2),
>             1,
>             2
>           )
>         )
>       }
>
> in my opionion it should evenly return 0, 1 and 2
>
> but I have tested this 100.000 with differents seeds and random points
> with script from the end of this post and it returned
>
> 0 - 0 times
> 1 - 64161 times
> 2 - 35839 times
>
> anybody can confirm ?
> here is script:
>
> #local Count0=0;
> #local Count1=0;
> #local Count2=0;
> #local MaxSeed=1000;
> #local MinRand=-1000;
> #local MaxRand=1000;
> #local Loops=100;
> #local CounterSeed=0;
> #while(CounterSeed<MaxSeed)
>   #local Seed=seed(CounterSeed);
>   #local Counter=0;
>   #while (Counter<Loops)
>     #switch(test(
>         Interpolate(rand(Seed),0,1,MinRand,MaxRand,0),
>         Interpolate(rand(Seed),0,1,MinRand,MaxRand,0),
>         0))
>       #case(0)
>         #local Count0=Count0+1;
>         #break
>       #case(1)
>         #local Count1=Count1+1;
>         #break
>       #case(2)
>         #local Count2=Count2+1;
>         #break
>       #else
>         #error "unexpected"
>     #end
>     #local Counter=Counter+1;
>   #end
>   #local CounterSeed=CounterSeed+1;
> #end
>
> ABX


Post a reply to this message

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