POV-Ray : Newsgroups : povray.beta-test : bug: select within select Server Time
12 Nov 2024 16:28:17 EST (-0500)
  bug: select within select (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From:
Subject: bug: select within select
Date: 1 Oct 2001 11:08:30
Message: <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

From: Slime
Subject: Re: select within select
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

From: Thorsten Froehlich
Subject: Re: bug: select within select
Date: 1 Oct 2001 12:36:12
Message: <3bb89b7c$1@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

> 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 ?

Do you by any chance have a _simpler_ version of this function?  Or does it
require f_noise3d to show the problem or will any nested select show the
problem?


    Thorsten


Post a reply to this message

From: Mike Williams
Subject: Re: bug: select within select
Date: 1 Oct 2001 14:20:00
Message: <C5fbDCACOLu7EwXB@econym.demon.co.uk>

>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 ?

I confirm the numbers, but I don't think it's anything to do with the
nesting of selects.

If you change to noise generator 1, the numbers come out even. It looks
to me like there's a subtlety in noise type 3 that causes
f_noise3d(integer, integer, 0) to always be greater than 1/3. I really
don't see that as being a problem because you shouldn't really expect
noise3d to be a random number generator.

[[But, does that actually mean that we don't have a decent random number
generator that we can use in a function? Rand() is not available inside
a function block.]] 

Adding:
        global_settings{
          noise_generator 1
        }       
to your scene gives the results:

0 - 35946 times
1 - 32982 times
2 - 31072 times

Which indicates that the nested selects are working perfectly, and
noise_generator 1 does happen to partition (floor(x),floor(y),0) into
three roughly equal thirds.


If you do the same thing, with the default noise generator, but without
the "floor()"s, then the results are:-

#local test=function{
        select(
          f_noise3d(x,y,0)-(1/3),
          0,
          select(
            f_noise3d(y,x,0)-(1/2),
            1,
            2
          )
        )
      }

0 - 13007 times
1 - 45476 times
2 - 41517 times



By the way, since you seem to like using "Interpolate()", I guess that
you have some idea of what it's supposed to do and what the parameters
mean. Would it be possible for you to enlighten the rest of us? The docs
have a bit of a hole there.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: bug: select within select
Date: 1 Oct 2001 14:29:58
Message: <3bb8b626$1@news.povray.org>
In article <C5f### [at] econymdemoncouk> , Mike Williams 
<mik### [at] nospamplease>  wrote:

> I confirm the numbers, but I don't think it's anything to do with the
> nesting of selects.
>
> If you change to noise generator 1, the numbers come out even. It looks
> to me like there's a subtlety in noise type 3 that causes
> f_noise3d(integer, integer, 0) to always be greater than 1/3. I really
> don't see that as being a problem because you shouldn't really expect
> noise3d to be a random number generator.

Thank you for finding this!  So it is not a bug, but simply the wrong
noise_generator.  There has a lot been written about the old/default noise
generator's problems, and I guess this is one good example of them.

> [[But, does that actually mean that we don't have a decent random number
> generator that we can use in a function? Rand() is not available inside
> a function block.]]

True, there is none because for such functions it would not be possible to
find the surface (it would be changing every time one calculates the value
at the same spot).


    Thorsten


____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Mike Williams
Subject: Re: bug: select within select
Date: 1 Oct 2001 20:26:41
Message: <CSbrJDAROQu7EwlA@econym.demon.co.uk>
Wasn't it Thorsten Froehlich who wrote:
>In article <C5f### [at] econymdemoncouk> , Mike Williams 
><mik### [at] nospamplease>  wrote:
>
>> I confirm the numbers, but I don't think it's anything to do with the
>> nesting of selects.
>>
>> If you change to noise generator 1, the numbers come out even. It looks
>> to me like there's a subtlety in noise type 3 that causes
>> f_noise3d(integer, integer, 0) to always be greater than 1/3. I really
>> don't see that as being a problem because you shouldn't really expect
>> noise3d to be a random number generator.
>
>Thank you for finding this!  So it is not a bug, but simply the wrong
>noise_generator.  There has a lot been written about the old/default noise
>generator's problems, and I guess this is one good example of them.

It's the NEW noise generator that is exhibiting the strange behaviour at
integer coordinates. The old noise generator that behaves sensibly in
this respect.

2.6.1: The default generator, type 3, is a completely new Perlin noise
function. You can also choose noise_generator 1, which behaves like the
noise in POV-Ray 3.1 and earlier.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From:
Subject: Re: select within select
Date: 22 Oct 2001 05:46:57
Message: <0mq7tt888pac9hsj5r5b4l4jatn5ooahi5@4ax.com>
On Mon, 1 Oct 2001 12:28:02 -0400, "Slime" <noo### [at] hotmailcom>
wrote:

> Well, for them to appear *evenly*, you would have to change the (1/2) to
> (2/3).

I think you are wrong.

ABX


Post a reply to this message

From:
Subject: Re: bug: select within select
Date: 22 Oct 2001 05:54:18
Message: <s9p7ttk0cqadgpvrkjquu9r2c5tai77u6g@4ax.com>
On Mon, 1 Oct 2001 19:18:42 +0100, Mike Williams <mik### [at] nospamplease>
wrote:

> Wasn't it W?odzimierz ABX Skiba who wrote:
> > in my opionion it should evenly return 0, 1 and 2
> >
> > 0 - 0 times
> > 1 - 64161 times
> > 2 - 35839 times
>
> I confirm the numbers, but I don't think it's anything to do with the
> nesting of selects.
>
> If you change to noise generator 1, the numbers come out even. It looks
> to me like there's a subtlety in noise type 3 that causes
> f_noise3d(integer, integer, 0) to always be greater than 1/3.

Thanks for finding and pointing this.
I think there should be note withing documentation about
characteristic of noise generators.

> I really
> don't see that as being a problem because you shouldn't really expect
> noise3d to be a random number generator.

I don't expect. They are just good to make "random but constant"
mosaics in textures/pigments. :-)

> If you do the same thing, with the default noise generator, but without
> the "floor()"s, then the results are:-
>
> 0 - 13007 times
> 1 - 45476 times
> 2 - 41517 times

they are similiar to noise_generator 2 with floor() for args

> By the way, since you seem to like using "Interpolate()",

sorry. it's macro from standard "math.inc"

ABX


Post a reply to this message

From: ingo
Subject: Re: bug: select within select
Date: 22 Oct 2001 08:37:06
Message: <Xns914294B46DB06seed7@povray.org>

Skiba wrote:

> I think there should be note withing documentation about
> characteristic of noise generators.
> 

What kind of characteristics do you mean and what are they.
I posted two images in p.b-t.b with histograms, is this sufficient?

Ingo

-- 
Photography: http://members.home.nl/ingoogni/
Pov-Ray    : http://members.home.nl/seed7/


Post a reply to this message

From:
Subject: Re: bug: select within select
Date: 22 Oct 2001 10:05:20
Message: <fs98ttg2cuuk2484bbl2su4vmgljvjoqkl@4ax.com>
On 22 Oct 2001 08:37:06 -0400, ingo <ing### [at] homenl> wrote:
> in news:s9p7ttk0cqadgpvrkjquu9r2c5tai77u6g@4ax.com W?odzimierz ABX 
> Skiba wrote:
>
> > I think there should be note withing documentation about
> > characteristic of noise generators.
> > 
>
> What kind of characteristics do you mean and what are they.

I'm talking about few words about results for some special args. As
this thread shows one sentence can be: "for integer args generator 3
returns only values above 1/3." Without sources I can't give more
examples - I found only this by experience. Perhaps something like
this occure for some generators:
noise(x,0,0)=noise(0,x,0)=noise(0,0,x). Or : noise(x,y,0)=noise(y,x,0)

> I posted two images in p.b-t.b with histograms, is this sufficient?

I though about characteristic as description. Such images have sense
only in small range. And are usfull when such range is repeated over
and over. But perhaps your images could be usefull for others.

ABX


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

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