POV-Ray : Newsgroups : povray.general : Smooth random Server Time
1 Nov 2024 09:21:41 EDT (-0400)
  Smooth random (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Larry Fontaine
Subject: Smooth random
Date: 9 Oct 1999 23:31:16
Message: <380008D1.9E67470B@isd.net>
How can I get a smooth random number, ie, it varies from the last random
number by no more than a certain amount? (I'm making a tree macro and
want a way to twist the limbs.)


Post a reply to this message

From: Ken
Subject: Re: Smooth random
Date: 9 Oct 1999 23:39:45
Message: <38000A77.65B88081@pacbell.net>
Larry Fontaine wrote:
> 
> How can I get a smooth random number, ie, it varies from the last random
> number by no more than a certain amount? (I'm making a tree macro and
> want a way to twist the limbs.)

I'll send you a possible solution by email. I would post the source but
it's a bit longish for this group.

-- 
Ken Tyler
1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Peter Popov
Subject: Re: Smooth random
Date: 10 Oct 1999 10:51:33
Message: <facAOGA2qGrV7lLFLS+8zDOcVwj8@4ax.com>
On Sat, 09 Oct 1999 22:32:33 -0500, Larry Fontaine <lfo### [at] isdnet>
wrote:

>How can I get a smooth random number, ie, it varies from the last random
>number by no more than a certain amount? (I'm making a tree macro and
>want a way to twist the limbs.)

There's a smooth random generator in the Throroughly Useful Macros by
John VanSickle. Search Ken's links :)


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Ken
Subject: Re: Smooth random
Date: 10 Oct 1999 11:07:44
Message: <3800AB52.9D98B08C@pacbell.net>
Peter Popov wrote:
> 
> On Sat, 09 Oct 1999 22:32:33 -0500, Larry Fontaine <lfo### [at] isdnet>
> wrote:
> 
> >How can I get a smooth random number, ie, it varies from the last random
> >number by no more than a certain amount? (I'm making a tree macro and
> >want a way to twist the limbs.)
> 
> There's a smooth random generator in the Throroughly Useful Macros by
> John VanSickle. Search Ken's links :)
> 
> Peter Popov
> ICQ: 15002700

I already sent it to him :)

-- 
Ken Tyler -  1100+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Margus Ramst
Subject: Re: Smooth random
Date: 10 Oct 1999 14:50:07
Message: <3800DFA8.54B90134@peak.edu.ee>
I'm not sure what you're after. The smooth rand macro is one solution.
I can also send you a Perlin noise macro I created. It takes a float as the
parameter and returns values within a certain limit. Close parameters give
statistically close values. The result is similar to turbulence - you have
control over octaves and omega - but the noise is 1D, i.e. it returns a float.
Let me know if you're interested, because I'd have to clean up the source before
posting it.

Margus

Larry Fontaine wrote:
> 
> How can I get a smooth random number, ie, it varies from the last random
> number by no more than a certain amount? (I'm making a tree macro and
> want a way to twist the limbs.)


Post a reply to this message

From: Nieminen Juha
Subject: Re: Smooth random
Date: 11 Oct 1999 06:05:15
Message: <3801b65b@news.povray.org>
Larry Fontaine <lfo### [at] isdnet> wrote:
: How can I get a smooth random number, ie, it varies from the last random
: number by no more than a certain amount?

  If you mean a linear distribution, that's pretty simple:

#declare Seed = seed(0);
#declare Number = rand(Seed);
#macro NextNumber(maxvariation)
  #declare Number = Number-maxVariation+maxvariation*rand(Seed)*2;
  Number
#end

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Margus Ramst
Subject: Re: Smooth random
Date: 11 Oct 1999 09:58:53
Message: <3801ECE8.15BDCAA9@peak.edu.ee>
Nieminen Juha wrote:
> 
>   If you mean a linear distribution, that's pretty simple:
> 

AFAIK, this is normal distribution.
I made two little macros that do normal distribution for floats and 3D vectors
(it's trivial to extend it to nD vectors). They take the mean, the maximum
deviation and a predeclared seed as parameters.
The macros are available from the Macroscope (rand_ext and v_rand_ext)

Margus


Post a reply to this message

From: Nieminen Juha
Subject: Re: Smooth random
Date: 11 Oct 1999 11:15:29
Message: <3801ff11@news.povray.org>
Margus Ramst <mar### [at] peakeduee> wrote:
: AFAIK, this is normal distribution.

  No, normal distribution is distributed in the form e^(-x^2). You can get
an approximation by calculating the average of at least three random numbers
(the more the numbers, the better the approximation, but three is usually
close enough).

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: PoD
Subject: Re: Smooth random
Date: 11 Oct 1999 12:54:01
Message: <380217A6.4861EB83@merlin.net.au>
Nieminen Juha wrote:
> 
> Margus Ramst <mar### [at] peakeduee> wrote:
> : AFAIK, this is normal distribution.
> 
>   No, normal distribution is distributed in the form e^(-x^2). You can get
> an approximation by calculating the average of at least three random numbers
> (the more the numbers, the better the approximation, but three is usually
> close enough).
> 

The more random numbers summed, the smaller the standard deviation.
PoD.


Post a reply to this message

From: Margus Ramst
Subject: Re: Smooth random
Date: 11 Oct 1999 20:56:48
Message: <38028723.6BE157C2@peak.edu.ee>
PoD wrote:
> 
> The more random numbers summed, the smaller the standard deviation.
> PoD.

But that's just a relative measure, anyway. You can increase dispersion by
scaling with the mean as the origin.

Margus


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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