POV-Ray : Newsgroups : povray.newusers : random elements in blob object Server Time
5 Sep 2024 08:19:45 EDT (-0400)
  random elements in blob object (Message 5 to 14 of 24)  
<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Warp
Subject: Re: random elements in blob object
Date: 2 Feb 2002 04:57:46
Message: <3c5bb819@news.povray.org>
koos <fra### [at] hotmailcom> wrote:
: I only don't get the reason why the seed declaration has to be placed
: outside the while-loop. 

  If you initialize the random number generator with the same value at
each loop, you'll get the same value from rand().
  A line like:

#declare S = seed(0);

means: "Make S a random number stream with the initial value 0". Successive
rand(S) calls will take values from that seed (and they are always the same
values).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Nekar Xenos
Subject: Re: random elements in blob object
Date: 3 Feb 2002 06:32:17
Message: <3c5d1fc1@news.povray.org>
"ingo" <ing### [at] homenl> wrote in message
news:Xns### [at] povrayorg...
> in news:01c1abc2$cd6f19a0$667dd383@etnica koos wrote:
>
> > Thanks, for the help. It really works!!
>
> Gaaf he.
>

Dutch?

--
#local X=20*<-2,2,5>;sphere_sweep{catmull_rom_spline 6<-8,-8>1<-8,-8>1<-8,8>1<
8,-8>1<8,8>1<8,8>1translate 20*z pigment{gradient z scale 3color_map{[0rgb<0,9
,18>][1rgb 0]}}}#local K=2*z*X-X;#local R=seed(clock);blob{#while(K.x>X.x)
#local N=X+<rand(R)rand(R)1>/3;#local X=(vlength(N-K)<vlength(X-K)?N:2*X-N);
sphere{X,1,1rotate z*90}sphere{X,1,1}#end pigment{rgbt 1}interior{media{//Nekar
emission<2,4,5>*5}}hollow scale.05}//   http://nekar_xenos.tripod.com/metanoia/


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 2002/01/21


Post a reply to this message

From: ingo
Subject: Re: random elements in blob object
Date: 3 Feb 2002 06:44:26
Message: <Xns91AA81E131676seed7@povray.org>
in news:3c5d1fc1@news.povray.org Nekar Xenos wrote:

> Dutch?
> 

Ja.

Ingo


Post a reply to this message

From: Koos Jan Niesink
Subject: Re: random elements in blob object
Date: 4 Feb 2002 04:36:40
Message: <3c5e5628$1@news.povray.org>
Inderdaad ;-)
thanks for the explanation

In article <Xns### [at] povrayorg>, "ingo" <ing### [at] homenl>
wrote:


> in news:3c5d1fc1@news.povray.org Nekar Xenos wrote:
>> Dutch?
>> 
> Ja.
> Ingo


Post a reply to this message

From: Nekar Xenos
Subject: Re: random elements in blob object
Date: 4 Feb 2002 07:37:15
Message: <3c5e807b@news.povray.org>
"Koos Jan Niesink" <koo### [at] hotpopcom> wrote in message
news:3c5e5628$1@news.povray.org...
> Inderdaad ;-)
> thanks for the explanation
>
> In article <Xns### [at] povrayorg>, "ingo" <ing### [at] homenl>
> wrote:
>
>
> > in news:3c5d1fc1@news.povray.org Nekar Xenos wrote:
> >> Dutch?
> >>
> > Ja.
> > Ingo

Dit lyk vir my daar is heelwat meer Nederlanders hier as wat ek gedink het. Ek
vermoed hier is dalk ook 'n paar Vlaams sprekendes? Verskoon my spelling - ek is
Afrikaans.

I didn't see any [NE] on the povray.international so I never looked there
again...

--
#local X=20*<-2,2,5>;sphere_sweep{catmull_rom_spline 6<-8,-8>1<-8,-8>1<-8,8>1<
8,-8>1<8,8>1<8,8>1translate 20*z pigment{gradient z scale 3color_map{[0rgb<0,9
,18>][1rgb 0]}}}#local K=2*z*X-X;#local R=seed(clock);blob{#while(K.x>X.x)
#local N=X+<rand(R)rand(R)1>/3;#local X=(vlength(N-K)<vlength(X-K)?N:2*X-N);
sphere{X,1,1rotate z*90}sphere{X,1,1}#end pigment{rgbt 1}interior{media{//Nekar
emission<2,4,5>*5}}hollow scale.05}//   http://nekar_xenos.tripod.com/metanoia/


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 2002/01/21


Post a reply to this message

From: Tom Melly
Subject: Re: random elements in blob object
Date: 4 Feb 2002 09:29:28
Message: <3c5e9ac8$1@news.povray.org>
"koos" <fra### [at] hotmailcom> wrote in message
news:01c1abbb$9437bf40$667dd383@etnica...

<snip>

Well, you've had answers to your initial problem.

Here's a subtler trap with random streams....

#declare S1 = seed(32534);
#while(1=1)
    #declare S2 = seed(rand(S1))
    object{foo translate y*rand(S2)}
#end

Here, you get some variation for rand(S2), but not a lot. This is because the
seed to S2 is always in the range 0 -> 1, which returns a random stream with
very little variation.


Post a reply to this message

From: Deaken
Subject: Re: random elements in blob object
Date: 5 Feb 2002 06:03:01
Message: <3C5FBC39.8BF959D6@sw-tech.com>
Tom Melly wrote:
> 
> #declare S1 = seed(32534);
> #while(1=1)
>     #declare S2 = seed(rand(S1))
>     object{foo translate y*rand(S2)}
> #end
> 
> Here, you get some variation for rand(S2), but not a lot. This is because the
> seed to S2 is always in the range 0 -> 1, which returns a random stream with
> very little variation.

Wait.  The way I'm reading this, the smaller the (absolute value of the)
seed is, the less the stream varies.

Please tell me that I'm misunderstanding.

If I'm not, can someone post a brief summary (my C is very bad) of why
(computer, not design decision) this is?

Deaken


Post a reply to this message

From: Warp
Subject: Re: random elements in blob object
Date: 5 Feb 2002 06:23:44
Message: <3c5fc0c0@news.povray.org>
Deaken <dwy### [at] sw-techcom> wrote:
: If I'm not, can someone post a brief summary (my C is very bad) of why
: (computer, not design decision) this is?

  Perhaps seed() takes just the integer part of the given parameter?
(I don't know, I'm just guessing.)

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Deaken
Subject: Re: random elements in blob object
Date: 5 Feb 2002 06:30:58
Message: <3C5FC2C7.DEC8D4C8@sw-tech.com>
Warp wrote:
> 
> Deaken <dwy### [at] sw-techcom> wrote:
> : If I'm not, can someone post a brief summary (my C is very bad) of why
> : (computer, not design decision) this is?
> 
>   Perhaps seed() takes just the integer part of the given parameter?
> (I don't know, I'm just guessing.)

The docs for 3.1 say that seed() takes a float.  I can't find the relevant
part in the 3.5 docs.

Deaken


Post a reply to this message

From: Christopher James Huff
Subject: Re: random elements in blob object
Date: 5 Feb 2002 11:15:22
Message: <chrishuff-54F93A.11165805022002@netplex.aussie.org>
In article <3C5FBC39.8BF959D6@sw-tech.com>, Deaken <dwy### [at] sw-techcom> 
wrote:

> Wait.  The way I'm reading this, the smaller the (absolute value of the)
> seed is, the less the stream varies.

No, the less the seed varies, the less the stream varies (from other 
streams, not internally). Since only the first random number of each 
stream is used, this means there will be some variation, but it won't be 
random.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>

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