|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ooops.
I forgot that there needs to be +0.4 or +0.5 inside the log..
my mistake..
#declare s = seed(6666);
(log(rand(s)+0.5)*60)-30
This should perhaps be better.
//Spider
//Spider
Dan Connelly wrote:
>
> Whoa!! This is unbound on the lower end -- lim[x->0]{log{x}}->-infty
>
> A simpler approach is simply to exploit the central limit theorem, and
> take averages....
>
> #declare A = ((rand(s)+rand(s)+rand(s))*20 - 30;
>
> for example.
>
> Spider wrote:
> >
> > You can try :
> > #declaree s = seed(6666);
> > (log(rand(s))*60)-30
> > this may be what you want..
> >
> > //Spider
> >
> > ingo wrote:
> > >
> > > Hi,
> > > I'm trying to make randomly curled paper sheets, I have two questions on
> > > this:
> > > 1. Although I don't need mutch detail I'd like to smooth the paper, so how
> > > to calculate the normals for smooth triangles?
> > > 2. How do I generate random numbers between -30 and +30, in such a way that
> > > there are mutch more between -15 and 15 than between -30 and 30?
>
> --
> http://www.flash.net/~djconnel/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ingo <ing### [at] ingodemonnl> wrote:
: 1. Although I don't need mutch detail I'd like to smooth the paper, so how
: to calculate the normals for smooth triangles?
You can use my triangle mesh smoother:
http://iki.fi/warp/PovUtils/smooth.html
--
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp. -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you all,
I'll give it a try.
ingo
--
Met dank aan de muze met het glazen oog.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I try to make a whirl(wind) of about 100+ sheets of paper. Before I asked, I
thought about your tool and somehow thought it's not what I want.
Actually read smooth.txt after your post, the second half explains very good
what I'm looking for. Since a sheet of paper is only 8 triangles I'll try to
put it in a macro. Else Smoother it will be.
Thanks,
ingo
--
Met dank aan de muze met het glazen oog.
Nieminen Mika heeft geschreven in bericht <36c013a0.0@news.povray.org>...
> You can use my triangle mesh smoother:
>
>http://iki.fi/warp/PovUtils/smooth.html
>
>--
>main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
>*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*-
Warp. -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
No, sir, it's still not correct. Plot this curve from RAND(S) = 0 to 1 and look at
the shape!
Try, instead:
#declare RR = seed(231);
#declare v3030 = pwr((rand(RR)-0.5),3)*240;
[I always have to look up the 3.02 docs: is X^3 represented as POW(X,3) or PWR(X,3)
? ]
Spider wrote:
> Ooops.
> I forgot that there needs to be +0.4 or +0.5 inside the log..
> my mistake..
> #declare s = seed(6666);
> (log(rand(s)+0.5)*60)-30
>
> This should perhaps be better.
>
> //Spider
>
> //Spider
>
> Dan Connelly wrote:
> >
> > Whoa!! This is unbound on the lower end -- lim[x->0]{log{x}}->-infty
> >
> > A simpler approach is simply to exploit the central limit theorem, and
> > take averages....
> >
> > #declare A = ((rand(s)+rand(s)+rand(s))*20 - 30;
> >
> > for example.
> >
> > Spider wrote:
> > >
> > > You can try :
> > > #declaree s = seed(6666);
> > > (log(rand(s))*60)-30
> > > this may be what you want..
> > >
> > > //Spider
> > >
> > > ingo wrote:
> > > >
> > > > Hi,
> > > > I'm trying to make randomly curled paper sheets, I have two questions on
> > > > this:
> > > > 1. Although I don't need mutch detail I'd like to smooth the paper, so how
> > > > to calculate the normals for smooth triangles?
> > > > 2. How do I generate random numbers between -30 and +30, in such a way that
> > > > there are mutch more between -15 and 15 than between -30 and 30?
> >
> > --
> > http://www.flash.net/~djconnel/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Most random number generators produce uniform-distributed
random numbers, not normally -distributed random numbers.
There's an old programmer's trick (at least as old as
FORTRAN 4) to approximate normal distributions from uniform
ones.... take TWO uniform randoms of half the range and add
them together to get final value!
Hope this helps
Tim Glover
tgl### [at] nettallycom
ingo wrote:
>
SNIP
> 2. How do I generate random numbers between -30 and +30, in such a way that
> there are mutch more between -15 and 15 than between -30 and 30?
>
SNIP
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tim Glover <tgl### [at] nettallycom> wrote:
: Most random number generators produce uniform-distributed
: random numbers, not normally -distributed random numbers.
: There's an old programmer's trick (at least as old as
: FORTRAN 4) to approximate normal distributions from uniform
: ones.... take TWO uniform randoms of half the range and add
: them together to get final value!
Actually this will not give a normal distribution. If you want a normal
distribution you have to add at least three random numbers or more.
--
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Actually, I said "approximate" a normal distribution. As long
as you're adding a finite number of uniform numbers together,
you're only approximating a normal distribution. Lots of numbers
just gives a better approximation. My way's approximation is just
not quite as good as your's <grin>
tgl### [at] nettallycom
Nieminen Mika wrote:
>
> Tim Glover <tgl### [at] nettallycom> wrote:
> : Most random number generators produce uniform-distributed
> : random numbers, not normally -distributed random numbers.
> : There's an old programmer's trick (at least as old as
> : FORTRAN 4) to approximate normal distributions from uniform
> : ones.... take TWO uniform randoms of half the range and add
> : them together to get final value!
>
> Actually this will not give a normal distribution. If you want a normal
> distribution you have to add at least three random numbers or more.
>
> --
> main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
> *_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Nieminen Mika <war### [at] cctutfi> writes:
> Actually this will not give a normal distribution. If you want a normal
> distribution you have to add at least three random numbers or more.
Or... Generate it accurately. If the numbers you want to generate
are bound to a finite interval [a,b], here is a trick that generates any
distribution on it.
Let f(x) be a function giving the law (density of probability) of your
random number (with a multiplicative constant somewhere). Multiply it
by a constant so that it is always between 0 and 1. Then generate a
uniform random variable on the interval you want to reach:
rand_ab()=a+(b-a)*rand(), with rand() being in [0,1]. To construct a
distribution with the law f(x),the algorithm is the following:
- take a number x=rand_ab();
- calculate f(x);
- take a random number in [0,1], y;
- if y<f(x), then keep x, else go back to step 1;
- if you kept x, then this is your final number.
The calculations (I made them some months ago) are quite simple. They
show that this algorithm gives you any law of probability you may
want. You can adapt it (via atan() or something like that) to
infinite arrival space, or to add weighted points.
Hope this helps,
Roland.
--
Roland Mas
Sauvez les castors, plantez des arbres.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Tim Glover <tgl### [at] nettallycom> wrote:
: Actually, I said "approximate" a normal distribution. As long
: as you're adding a finite number of uniform numbers together,
: you're only approximating a normal distribution. Lots of numbers
: just gives a better approximation. My way's approximation is just
: not quite as good as your's <grin>
It's a VERY rough approximate, since by adding just two random values
you get a triangle wave distribution. With 3 values it certainly looks a lot
more like a normal distribution.
--
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |