POV-Ray : Newsgroups : povray.general : 2Q's: normal & random Server Time
4 Nov 2024 17:31:22 EST (-0500)
  2Q's: normal & random (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: ingo
Subject: 2Q's: normal & random
Date: 8 Feb 1999 15:11:17
Message: <36bf44e5.0@news.povray.org>
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?

ingo


#version 3.1;
#include "colors.inc"
global_settings{assumed_gamma 1.0}

light_source{
  <500,500,-500>
  color rgb 1
}
camera{
    location<0.0,0.0,-2.5>
    look_at<0.0,0.0,0.0>
}
//  #declare Rnd ......
#declare A=vrotate(vaxis_rotate(<-0.25,0.25,
0>,<1,1,0>,Rnd)+<-0.25,0.25,0>,<Rnd,Rnd,0>);
#declare B=vrotate(<0,0.5,0>,<Rnd,0,0>);
#declare C=vrotate(vaxis_rotate(<0.25,0.25, 0>,<1,-1, 0>,Rnd)
+<0.25,0.25,0>,<Rnd,Rnd,0>);
#declare D=vrotate(<-0.5,0,0>,<0,Rnd,0>);
#declare E=<0,0,0>;
#declare F=vrotate(<0.5,0,0>,<0,Rnd,0>);
#declare G=vrotate(vaxis_rotate(<-0.25,-0.25,0>,<-1,1,0>,Rnd)
+<-0.25,-0.25,0>,<Rnd,Rnd,0>);
#declare H=vrotate(<0,-0.5,0>,<Rnd,0,0>);
#declare I=vrotate(vaxis_rotate(<0.25,-0.25,0>,<-1,-1,0>,Rnd)
+<0.25,-0.25,0>,<Rnd,Rnd,0>);

mesh {
  triangle {A,B,D}
  triangle {D,B,E}
  triangle {E,B,F}
  triangle {B,C,F}
  triangle {D,G,H}
  triangle {D,H,E}
  triangle {E,H,F}
  triangle {H,I,F}
  scale <1,2,1>
  pigment {rgb 1}
}

---
Thank, to the Muse with the glass eye.


Post a reply to this message

From: Stephen Lavedas
Subject: Re: 2Q's: normal & random
Date: 8 Feb 1999 19:57:29
Message: <36BF880C.5F5195E5@virginia.edu>
To answer the question about random numbers, I would assume that due to
probabilitistic sampling, there SHOULD be more numbers around the center
(one or two deviations) than the edges.  BUT I assume you aren't getting
the results you want, so you could try a couple of things.  One, run the
randoms between -15 and 15 first, then another run out to the 30's... or
start with a random from like -2 to 2 and then slowly increase out to
the 30's...should distribute more centrally.

Steve


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?
> 
> ingo
> 
> #version 3.1;
> #include "colors.inc"
> global_settings{assumed_gamma 1.0}
> 
> light_source{
>   <500,500,-500>
>   color rgb 1
> }
> camera{
>     location<0.0,0.0,-2.5>
>     look_at<0.0,0.0,0.0>
> }
> //  #declare Rnd ......
> #declare A=vrotate(vaxis_rotate(<-0.25,0.25,
> 0>,<1,1,0>,Rnd)+<-0.25,0.25,0>,<Rnd,Rnd,0>);
> #declare B=vrotate(<0,0.5,0>,<Rnd,0,0>);
> #declare C=vrotate(vaxis_rotate(<0.25,0.25, 0>,<1,-1, 0>,Rnd)
> +<0.25,0.25,0>,<Rnd,Rnd,0>);
> #declare D=vrotate(<-0.5,0,0>,<0,Rnd,0>);
> #declare E=<0,0,0>;
> #declare F=vrotate(<0.5,0,0>,<0,Rnd,0>);
> #declare G=vrotate(vaxis_rotate(<-0.25,-0.25,0>,<-1,1,0>,Rnd)
> +<-0.25,-0.25,0>,<Rnd,Rnd,0>);
> #declare H=vrotate(<0,-0.5,0>,<Rnd,0,0>);
> #declare I=vrotate(vaxis_rotate(<0.25,-0.25,0>,<-1,-1,0>,Rnd)
> +<0.25,-0.25,0>,<Rnd,Rnd,0>);
> 
> mesh {
>   triangle {A,B,D}
>   triangle {D,B,E}
>   triangle {E,B,F}
>   triangle {B,C,F}
>   triangle {D,G,H}
>   triangle {D,H,E}
>   triangle {E,H,F}
>   triangle {H,I,F}
>   scale <1,2,1>
>   pigment {rgb 1}
> }
> 
> ---
> Thank, to the Muse with the glass eye.


Post a reply to this message

From: Spider
Subject: Re: 2Q's: normal & random
Date: 8 Feb 1999 20:25:50
Message: <36BF8D5B.4F621019@bahnhof.se>
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?
> 
> ingo
> 
> #version 3.1;
> #include "colors.inc"
> global_settings{assumed_gamma 1.0}
> 
> light_source{
>   <500,500,-500>
>   color rgb 1
> }
> camera{
>     location<0.0,0.0,-2.5>
>     look_at<0.0,0.0,0.0>
> }
> //  #declare Rnd ......
> #declare A=vrotate(vaxis_rotate(<-0.25,0.25,
> 0>,<1,1,0>,Rnd)+<-0.25,0.25,0>,<Rnd,Rnd,0>);
> #declare B=vrotate(<0,0.5,0>,<Rnd,0,0>);
> #declare C=vrotate(vaxis_rotate(<0.25,0.25, 0>,<1,-1, 0>,Rnd)
> +<0.25,0.25,0>,<Rnd,Rnd,0>);
> #declare D=vrotate(<-0.5,0,0>,<0,Rnd,0>);
> #declare E=<0,0,0>;
> #declare F=vrotate(<0.5,0,0>,<0,Rnd,0>);
> #declare G=vrotate(vaxis_rotate(<-0.25,-0.25,0>,<-1,1,0>,Rnd)
> +<-0.25,-0.25,0>,<Rnd,Rnd,0>);
> #declare H=vrotate(<0,-0.5,0>,<Rnd,0,0>);
> #declare I=vrotate(vaxis_rotate(<0.25,-0.25,0>,<-1,-1,0>,Rnd)
> +<0.25,-0.25,0>,<Rnd,Rnd,0>);
> 
> mesh {
>   triangle {A,B,D}
>   triangle {D,B,E}
>   triangle {E,B,F}
>   triangle {B,C,F}
>   triangle {D,G,H}
>   triangle {D,H,E}
>   triangle {E,H,F}
>   triangle {H,I,F}
>   scale <1,2,1>
>   pigment {rgb 1}
> }
> 
> ---
> Thank, to the Muse with the glass eye.


Post a reply to this message

From: Dan Connelly
Subject: Re: 2Q's: normal & random
Date: 8 Feb 1999 20:42:14
Message: <36BE40D4.B5C7385@flash.net>
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

From: Spider
Subject: Re: 2Q's: normal & random
Date: 8 Feb 1999 21:02:16
Message: <36BF95F3.24FA6F0@bahnhof.se>
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

From: Nieminen Mika
Subject: Re: 2Q's: normal & random
Date: 9 Feb 1999 05:53:20
Message: <36c013a0.0@news.povray.org>
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

From: ingo
Subject: Re: 2Q's: normal & random
Date: 9 Feb 1999 16:09:38
Message: <36c0a412.0@news.povray.org>
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

From: ingo
Subject: Re: 2Q's: normal & random
Date: 9 Feb 1999 16:09:40
Message: <36c0a414.0@news.povray.org>
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

From: Greg M  Johnson
Subject: Re: 2Q's: normal & random
Date: 11 Feb 1999 14:48:33
Message: <36C3335B.14418CC4@aol.com>
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

From: Tim Glover
Subject: A random trick
Date: 12 Feb 1999 11:15:36
Message: <36C45410.499B@nettally.com>
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

Goto Latest 10 Messages Next 4 Messages >>>

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