POV-Ray : Newsgroups : povray.general : Help with a spherical container : Re: Help with a spherical container Server Time
4 Aug 2024 02:23:59 EDT (-0400)
  Re: Help with a spherical container  
From: Christopher James Huff
Date: 5 Nov 2003 09:39:53
Message: <cjameshuff-54E6AE.09393705112003@netplex.aussie.org>
In article <Xns### [at] 204213191226>,
 Alain <noe### [at] onca> wrote:

> (Where 5 is your radius)
> 
> 5/(1+rand(S))*vnormalize(-1+2*<rand(S),rand(S),rand(S)>)

This will not give anything close to an even distribution. The places 
where points in the corners of the box were projected onto the sphere 
surface will have higher densities. And I have no idea what you think 
you're doing by subtracting a uniform random value in the range [0, 1] 
from 1...this has no effect. And then dividing 5 by that value...you do 
know this will give points with distances from the origin from 5 units 
out to infinity, don't you? Points *outside* the sphere, most of them 
*far* outside.


> This was derived from the random distribution:
> 
> 5*rand(S)*vnormalize(-1+2*<rand(S),rand(S),rand(S)>)

Which itself is badly flawed, and won't give anything close to a uniform 
distribution.


> But, given that a sphere will have a higher concentration of points near 
> the center, I thought you might prefer to place them inversely 
> proportional to the distance from the center.

VRand_In_Sphere() gives an even distribution, the density of points is 
equal over the volume of the sphere.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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