|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I looked online and found quite a useful equation for generating
gaussian random nubmers. This macro generates a random number that is
roughly between -3 and 3. The numbers will be normally distributed
(mean = 0 standard deviation 1).
This is very useful for something like randomly rotating bricks or
tiles. Using the pov-ray random function, they would all be rotated
randomly from 0 degrees to x degrees, but with this macro, about 2/3 are
between 0 and x degrees while there are a few outliers. It gives it a
more natural look.
- Rico
Here's the site in case someone wants to take a look at the second
equation (I couldn't get it to work correctly):
http://www.taygeta.com/random/gaussian.html
And here's the macro:
#declare e = 2.718281828459;
#macro gauss(RSR)
sqrt(-2*log(rand(RSR))/log(e))*cos(2*pi*rand(RSR))
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Reusser wrote:
>
> #declare e = 2.718281828459;
> #macro gauss(RSR)
> sqrt(-2*log(rand(RSR))/log(e))*cos(2*pi*rand(RSR))
> #end
Oh yeah, in case you didn't figure it out, you have to define a seed like
this:
#declare S = seed(2003);
#declare random_number = gauss(S);
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Reusser <reu### [at] chorusnet> wrote:
: sqrt(-2*log(rand(RSR))/log(e))*cos(2*pi*rand(RSR))
Isn't log(e) equal to 1?
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
>
> Reusser <reu### [at] chorusnet> wrote:
> : sqrt(-2*log(rand(RSR))/log(e))*cos(2*pi*rand(RSR))
>
> Isn't log(e) equal to 1?
Not on my calculator. Perhaps you are thinking of ln(e), which is equal
to 1.
log(e) is 0.443429448....
/Ib
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> Isn't log(e) equal to 1?
It depends who you ask. log BASE E of e is one, but pov-ray assumes that the
base is 10. This gives you 10^x = e, which is something like .434. I don't
know how it used to be, but now the assumed base of a log is 10. Looking at
my dad's 1970's textbook, it appears to use e.
- Rico
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Reusser" <reu### [at] chorusnet> schreef in bericht
news:3B3FACCE.EB5780BF@chorus.net...
> Warp wrote:
> > Isn't log(e) equal to 1?
>
> It depends who you ask. log BASE E of e is one, but pov-ray assumes that
the
> base is 10. This gives you 10^x = e, which is something like .434. I
don't
> know how it used to be, but now the assumed base of a log is 10. Looking
at
> my dad's 1970's textbook, it appears to use e.
In mathematics, log(10)=1 and ln(e)=1, but from the pov-ray help files
(float functions):
# log(A) Natural logarithm of A. Returns the natural logarithm base e of the
value A.
So pov-ray doesn't seem to follow the mathematical standard.
Frits van Bommel
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ib Rasmussen <ib### [at] ibrasdk> wrote:
:> Isn't log(e) equal to 1?
: Not on my calculator.
I was asking about log(e) in POV-Ray.
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Reusser <reu### [at] chorusnet> wrote:
:> Isn't log(e) equal to 1?
: It depends who you ask. log BASE E of e is one, but pov-ray assumes that the
: base is 10.
Wrong. POV-Ray assumes that the base is e.
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> Wrong. POV-Ray assumes that the base is e.
Well I stand corrected. It still works either way, so I guess you can just change
it to 1.
- Rico
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> Wrong. POV-Ray assumes that the base is e.
Wait a minute. I made my assumption on the fact that pov-ray has a ln keyword. I
assumed that that meant there was also a natural log in which case log would be
base 10. If this is not the case, then what does ln do?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |