POV-Ray : Newsgroups : povray.newusers : problems with rand Server Time
4 Nov 2024 12:59:36 EST (-0500)
  problems with rand (Message 1 to 2 of 2)  
From: Janne
Subject: problems with rand
Date: 29 Jul 2003 19:59:45
Message: <3f270a71$1@news.povray.org>
Hi,
I want to place tree rows along the z axis. Trees should be rotated
randomly, but each tree pair (trees that are located in Pos and 0-Pos)
should have same amount of rotation.

Currently following code doesn't do that; All of the trees are rotated with
equal values. My guess is that for some reason RdmC isn't updated when it's
called by RA.

Question: Why this xxxxxxx code doesn't work?

Sorry if I offended anyone. I guess i'm a little bit tired. I'm writing this
at 3.21 AM and should be at work by 8.00.
Hmm, maybe I should join POVoholics Anonymous :) :) Anyway here's the code:

#include "rand.inc"

#while(A<Loop)

#declare RP=VRand_In_Box(<-1,4.9,-5>,<1,5,-5> , RdmA);
#declare Pos=trace(Lightside, <RP.x,100,RP.z>,<0,-1,0>,Norm);

#declare RA=RdmC;

object{ TREE scale 0.12 rotate y*360*RA translate Pos}
object{ TREE2 scale 0.12 rotate y*360*RA translate <Pos.x, Pos.y, 0-Pos.z>}


#declare A=A+1;
#end

Thanks
Janne


Post a reply to this message

From: Mike Williams
Subject: Re: problems with rand
Date: 29 Jul 2003 21:04:15
Message: <Z3Q6TCAYlxJ$Ew80@econym.demon.co.uk>
Wasn't it Janne who wrote:
>Hi,
>I want to place tree rows along the z axis. Trees should be rotated
>randomly, but each tree pair (trees that are located in Pos and 0-Pos)
>should have same amount of rotation.
>
>Currently following code doesn't do that; All of the trees are rotated with
>equal values. My guess is that for some reason RdmC isn't updated when it's
>called by RA.
>
>Question: Why this xxxxxxx code doesn't work?
>
>. . .
>
>#declare RA=RdmC;

RdmC is the *seed* of a random number stream. To get a random number
from that stream you should write

#declare RA=rand(RdmC);


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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