 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hello all,
I am trying to create a blob object with a number of sphere, but I am
trying to place them at random. Now the following problem occurs, all
sphere are placed at the same position. The objection, of course, is to see
all the spheres. My code is as follows:
#declare bubbles = blob
{
threshold 0.5
#declare i = 0;
#while (i<50)
#declare S = seed(3415765);
#declare X = rand(S);
#declare Y = (rand(S)*2)+0.5;
#declare Z = rand(S);
sphere { <X, Y, Z>, 0.4, 0.55
pigment { color rgb <0.8, 0.3, 0.6> }
}
#declare i = i + 1;
#end
}
Any help would be appreciated,
Koos Jan Niesink
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
in news:01c1abbb$9437bf40$667dd383@etnica koos wrote:
> #declare bubbles = blob
> {
> threshold 0.5
> #declare i = 0;
> #while (i<50)
> #declare S = seed(3415765);
>
Mogge,
Take "#declare S = seed(3415765);" out of the while loop and put it above
"#declare bubbles=".
Ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Thanks, for the help. It really works!!
I only don't get the reason why the seed declaration has to be placed
outside the while-loop.
greetings/groeten, Koos Jan Niesink
ingo <ing### [at] home nl> schreef in artikel
<Xns### [at] povray org>...
> in news:01c1abbb$9437bf40$667dd383@etnica koos wrote:
>
> > #declare bubbles = blob
> > {
> > threshold 0.5
> > #declare i = 0;
> > #while (i<50)
> > #declare S = seed(3415765);
> >
>
> Mogge,
>
> Take "#declare S = seed(3415765);" out of the while loop and put it above
> "#declare bubbles=".
>
>
> Ingo
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
in news:01c1abc2$cd6f19a0$667dd383@etnica koos wrote:
> Thanks, for the help. It really works!!
Gaaf he.
> I only don't get the reason why the seed declaration has to be placed
> outside the while-loop.
#declare S= seed(7) intialises a random stream.
#declare Nr1= rand(S) takes the first random number from the stream.
#declare Nr2= rand(S) takes the second.
#declare Nr3= rand(S) the third.
Note that every time you render your scene Nr1 alway gets the same
value. Now if you put #declare S= seed(7) inside a loop, it gets
initialised every time the loop passes it. Thus the value of Nr1 will
always be the same.
Put the seed outside the loop, it is only initialised once. On the first
loop we will get the above result. On the second loop:
#declare Nr1= rand(S) takes the fourth random number from the stream.
#declare Nr2= rand(S) takes the fifth.
#declare Nr3= rand(S) the sixth.
etc.
The order of random numbers for a given seed is always the same.
Ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
koos <fra### [at] hotmail com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"ingo" <ing### [at] home nl> wrote in message
news:Xns### [at] povray org...
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
in news:3c5d1fc1@news.povray.org Nekar Xenos wrote:
> Dutch?
>
Ja.
Ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Inderdaad ;-)
thanks for the explanation
In article <Xns### [at] povray org>, "ingo" <ing### [at] home nl>
wrote:
> in news:3c5d1fc1@news.povray.org Nekar Xenos wrote:
>> Dutch?
>>
> Ja.
> Ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Koos Jan Niesink" <koo### [at] hotpop com> wrote in message
news:3c5e5628$1@news.povray.org...
> Inderdaad ;-)
> thanks for the explanation
>
> In article <Xns### [at] povray org>, "ingo" <ing### [at] home nl>
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"koos" <fra### [at] hotmail com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Deaken <dwy### [at] sw-tech com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
>
> Deaken <dwy### [at] sw-tech com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3C5FBC39.8BF959D6@sw-tech.com>, Deaken <dwy### [at] sw-tech com>
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] mac com>
POV-Ray TAG e-mail: chr### [at] tag povray org
TAG web site: http://tag.povray.org/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Christopher James Huff wrote:
>
> In article <3C5FBC39.8BF959D6@sw-tech.com>, Deaken <dwy### [at] sw-tech com>
> 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.
Okay, thanks. That's good to know.
Just as an aside, and feel free to ignore this question, how many values
would you suggest throwing away before the streams are no longer "close"?
Deaken
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Warp" <war### [at] tag povray org> wrote in message news:3c5fc0c0@news.povray.org...
> Deaken <dwy### [at] sw-tech com> 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.)
Nah - it's just that the stream created with seed(0.5) is very similiar to the
stream created with seed(0.6) - well IMHO, it certainly fits the symptoms. I
fell into this trap a couple of times. It was weird, things weren't exactly
identical, but nor were they random. All streams generated by seeds within a
range of 1 are pretty similiar.
If you want to use one stream as the seed for another, do something like
R2 = seed(rand(R1)*1000)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly <tom### [at] tomandlu co uk> wrote:
:> Perhaps seed() takes just the integer part of the given parameter?
:> (I don't know, I'm just guessing.)
: Nah - it's just that the stream created with seed(0.5) is very similiar to the
: stream created with seed(0.6) - well IMHO, it certainly fits the symptoms.
I don't think so. If you make a simple test, you'll see that there's
absolutely no difference between seed(0), seed(0.5) and seed(0.6). I have
the strong feeling that seed() takes just the integer part of the parameter.
I can try to check this from the source code.
#declare S1=seed(0.5);
#declare S2=seed(0.6);
#declare S3=seed(0);
#declare Ind=0;
#while(Ind<100)
#declare n1 = rand(S1);
#declare n2 = rand(S2);
#declare n3 = rand(S3);
#debug concat(str(rand(S1),0,17), " ",
str(rand(S2),0,17), " ",
str(rand(S3),0,17), " ")
#if(n1=n2 & n2=n3) #debug "equal\n"
#else #debug "different\n"
#end
#declare Ind=Ind+1;
#end
--
#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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp <war### [at] tag povray org> wrote:
: I can try to check this from the source code.
In express.cpp:
case SEED_TOKEN:
Val = stream_seed((int)Parse_Float_Param());
break;
I rest my case.
--
#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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 6 Feb 2002 16:15:47 -0500, Warp wrote:
> Warp <war### [at] tag povray org> wrote:
>: I can try to check this from the source code.
>
> In express.cpp:
>
> case SEED_TOKEN:
> Val = stream_seed((int)Parse_Float_Param());
> break;
>
>
> I rest my case.
How do we know you didn't just make that up? Just where is this express.cpp
anyway? :)
--
plane{-z,-3normal{crackle scale.2#local a=5;#while(a)warp{repeat x flip x}rotate
z*60#local a=a-1;#end translate-9*x}pigment{rgb 1}}light_source{-9red 1rotate 60
*z}light_source{-9rgb y rotate-z*60}light_source{9-z*18rgb z}text{ttf"arial.ttf"
"RP".01,0translate-<.6,.4,.02>pigment{bozo}}light_source{-z*3rgb-.2}//Ron Parker
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Ron Parker <ron### [at] povray org> wrote:
: How do we know you didn't just make that up? Just where is this express.cpp
: anyway? :)
It's identical to how it's done in express.c in the POV-Ray 3.1g source
(anyone can check this), and for now you only have to trust me that this
hasn't been changed in the 3.5 source code (it can be checked when the
source is released). :)
(Of course "you" here is in plural. Naturally you, Ron, can check it
right away. :) )
--
#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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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.
Flemish is almost the same as Dutch, that's why most people refer to both
languages as Dutch. I don't really agree with this. In my opinion, Dutch
resembles Flemish not much more than it resembles Afrikaans. (please, don't
start a discussion about it, I'm tired of those discussions...)
nog ne goeiendag!
--
camera{location-z*3}#macro G(b,e)b+(e-b)*(C/50)#end#macro L(b,e,k,l)#local C=0
;#while(C<50)sphere{G(b,e),.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1
;#end#end L(y-x,y,x,x+y)L(y,-x-y,x+y,y)L(-x-y,-y,y,y+z)L(-y,y,y+z,x+y)L(0,x+y,
<.5,1,.5>,x)L(0,x-y,<.5,1,.5>,x) // ZK http://www.povplace.be.tf
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
in news:3c619c12@news.povray.org Warp wrote:
> I have
> the strong feeling that seed() takes just the integer part of the
> parameter.
I'll change that in the docs (12)
Ingo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Warp" <war### [at] tag povray org> wrote in message news:3c619d02@news.povray.org...
>
> I rest my case.
>
Ah! Is this intended?
My impression was wrongly formed by placing several randomly generated objects
next to each other. The different viewpoints was just enough to convince me that
there were minor differences.
Still, the original point remains, R2 = seed(rand(R1)) is still a waste of time.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Tom Melly <tom### [at] tomandlu co uk> wrote:
: Ah! Is this intended?
I would guess that the random number generator algorithm used in povray
uses just integers.
--
#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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |