POV-Ray : Newsgroups : povray.advanced-users : Stochastics expertise needed Server Time
19 Apr 2024 01:49:52 EDT (-0400)
  Stochastics expertise needed (Message 1 to 10 of 26)  
Goto Latest 10 Messages Next 10 Messages >>>
From: clipka
Subject: Stochastics expertise needed
Date: 25 Aug 2016 20:15:43
Message: <57bf8a2f$1@news.povray.org>
Folks, I could need a bit of help with a maths problem.

I need an algorithm to generate random points on the surface of a
sphere, conforming to the following criteria:

- The distribution must be radially symmetric around the Y axis.
- The sample density should be roughly uniform, except for a pronounced
peak centered at +Y (but not -Y!)
- For each random point generated, the algorithm also needs to compute
the theoretical sample density at that location.
- The algorithm must be reasonably fast.

Ideally, the algorithm should also have the following properties:

- The density should fall off smoothly from the peak.
- The algorithm should have a parameter to govern the "tightness" of the
peak.
- The sample density away from the peak should approach (but not reach!)
zero.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 04:30:00
Message: <web.57bffd228629941bdadd19850@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Folks, I could need a bit of help with a maths problem.
>
> I need an algorithm to generate random points on the surface of a
> sphere, conforming to the following criteria:
>
> - The distribution must be radially symmetric around the Y axis.
> - The sample density should be roughly uniform, except for a pronounced
> peak centered at +Y (but not -Y!)
> - For each random point generated, the algorithm also needs to compute
> the theoretical sample density at that location.
> - The algorithm must be reasonably fast.
>
> Ideally, the algorithm should also have the following properties:
>
> - The density should fall off smoothly from the peak.
> - The algorithm should have a parameter to govern the "tightness" of the
> peak.
> - The sample density away from the peak should approach (but not reach!)
> zero.

I suppose no. 16 on http://mathworld.wolfram.com/SpherePointPicking.html hints
at the solution: You "just" need a space defined by a vector that meets the
above criteria. The "distortion" of the space at the selected point will then
allow computation of a scalar that should have some relation to the sample
density. Basically, with the shape of the unit hull you can also shape the
sample density by projecting it back on a unit sphere.

However, I am not sure if the "incorrect" example on that page won't
already solve most of your problem.


Post a reply to this message

From: clipka
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 05:36:31
Message: <57c00d9f@news.povray.org>
Am 26.08.2016 um 10:28 schrieb Thorsten Froehlich:

> I suppose no. 16 on http://mathworld.wolfram.com/SpherePointPicking.html hints
> at the solution: You "just" need a space defined by a vector that meets the
> above criteria. The "distortion" of the space at the selected point will then
> allow computation of a scalar that should have some relation to the sample
> density. Basically, with the shape of the unit hull you can also shape the
> sample density by projecting it back on a unit sphere.

"_hints_ at the solution"... "_some_ relation to the sample density"...
(emphasis added)... I think I see a pattern there ;)

> However, I am not sure if the "incorrect" example on that page won't
> already solve most of your problem.

Not exactly:

- It has samples bunching up at both poles, not just +Y.
- The tightness of the bunching-up cannot be tweaked.
- The off-peak density does not approach zero.


Post a reply to this message

From: Bald Eagle
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 11:45:00
Message: <web.57c063998629941bb488d9aa0@news.povray.org>
I'm busy at the moment, but:

define a sphere with radius 0.5
pow(x,2) + pow(y,2) = 0.5

so pow(y,2) = 0.5 - pow(x,2)

and y = sqrt ( 0.5 - pow(x,2))

translate y*0.5

y = sqrt ( 0.5 - pow(x,2)) +0.5

make your function equal to the sin of that times pi/2 so that the function
smoothly increases from 0 to 1

add the smallest number POV will work with to that (1E-whatever)

Multiply that by a line equation, the slop of which is the tightness

I will give this some more thought


Post a reply to this message

From: Bald Eagle
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 12:50:01
Message: <web.57c072418629941bb488d9aa0@news.povray.org>
Try this as a starting point

// spherical pattern
// Bald Eagle 2016
#version 3.7;

global_settings {assumed_gamma 1.0}

#include "colors.inc"
#include "textures.inc"
#include "rand.inc"

camera {
 location <0, 0.5, -2>
 look_at  <0, 0.5, 0>
}


light_source {<20, 50, -100> White shadowless}


#declare R = 0.5;
#declare Tiny = 0.000001;

#declare Stream = seed (123);

#for (Point, 1, 5000)
    #declare Variable = (VRand_On_Sphere(Stream)*0.5 + <0, 0.5, 0>);
    #debug concat( "Variable = ", vstr(3, Variable, ", ", 3, 3), " \n")
    #declare Color = <abs(pow (Variable.y, 1))+Tiny, 0, 0>;
    #debug concat( "Color = ", vstr(3, Color, ", ", 3, 3), " \n")
    sphere {Variable, 0.01 pigment {rgb Color}}
#end


Post a reply to this message

From: MichaelJF
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 13:15:01
Message: <web.57c078cf8629941b69e826dc0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Folks, I could need a bit of help with a maths problem.
>
> I need an algorithm to generate random points on the surface of a
> sphere, conforming to the following criteria:
>
> - The distribution must be radially symmetric around the Y axis.
> - The sample density should be roughly uniform, except for a pronounced
> peak centered at +Y (but not -Y!)
> - For each random point generated, the algorithm also needs to compute
> the theoretical sample density at that location.
> - The algorithm must be reasonably fast.
>
> Ideally, the algorithm should also have the following properties:
>
> - The density should fall off smoothly from the peak.
> - The algorithm should have a parameter to govern the "tightness" of the
> peak.
> - The sample density away from the peak should approach (but not reach!)
> zero.

I see a certain contradiction because a uniform distribution cannot fall off
smoothly to zero. My first idea is to use a 2D-normal distribution and project
it onto the sphere. One can play with the sigma(s) to sharpen the peak and/or
use weighted averages of such distributions.

Best regards,
Michael


Post a reply to this message

From: Bald Eagle
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 14:05:01
Message: <web.57c083f28629941bb488d9aa0@news.povray.org>
I see the "probability" aspect of this now...
no time to code it at the moment.

define a spline with a probability function
sparse near 0, denser near 1, maybe exponentially peaking at 1

choose rand between 0 and 1
pluck out y value from spline

then it's just a sphere in that y gradient


Post a reply to this message

From: LanuHum
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 16:20:00
Message: <web.57c0a3b08629941b7a3e03fe0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Folks, I could need a bit of help with a maths problem.
>
> I need an algorithm to generate random points on the surface of a
> sphere, conforming to the following criteria:
>
> - The distribution must be radially symmetric around the Y axis.
> - The sample density should be roughly uniform, except for a pronounced
> peak centered at +Y (but not -Y!)
> - For each random point generated, the algorithm also needs to compute
> the theoretical sample density at that location.
> - The algorithm must be reasonably fast.
>
> Ideally, the algorithm should also have the following properties:
>
> - The density should fall off smoothly from the peak.
> - The algorithm should have a parameter to govern the "tightness" of the
> peak.
> - The sample density away from the peak should approach (but not reach!)
> zero.

Let me simulate it in Blender. I use a system of particles and particle_map.
We have invented a bicycle.
Blender - your problem?


Post a reply to this message

From: Bald Eagle
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 16:40:00
Message: <web.57c0a88b8629941bb488d9aa0@news.povray.org>
"LanuHum" <Lan### [at] yandexru> wrote:
> We have invented a bicycle.

likely.  ;)

// Log spherical pattern
// Bald Eagle 2016
#version 3.7;

global_settings {assumed_gamma 1.0}

#include "colors.inc"
#include "textures.inc"
#include "rand.inc"


#declare R = 5;


camera {
 location <0, R, -15>
 look_at  <0, R, 0>
}


light_source {<20, 50, -100> White shadowless}



#declare Tiny = 0.000001;
#declare Stream = seed (123);
#declare Stream2 = seed (456);
#declare Stream3 = seed (789);

#declare Sphere_Spline =
  spline {
    linear_spline
   -0.25, <-0.25, 0.0, 0>,
    0.00, <0.00000000000000000001, 0.0, 0>,

    1.00, <1, 0, 0>
    1.1 , <1.1, 0, 0>
  } //-------------------




#declare Sphere1 =
union {
    #for (Point, 1, 1000)
        #declare Phi =  RRand(0, 2*pi, Stream);

        #declare Variable2 = RRand(1.00000001, 10, Stream2);

        #declare Theta = -pi*Sphere_Spline(1-log(Variable2))+(pi/2);

    #declare X = R * cos (Theta.x) * sin (Phi);
    #declare Z = R * cos (Theta.x) * cos (Phi);
    #declare Y = R * sin (Theta.x) + R;

    sphere {<X, Y, Z>, 0.01 pigment {Red} }
    #end
}



object {Sphere1}


Post a reply to this message

From: LanuHum
Subject: Re: Stochastics expertise needed
Date: 26 Aug 2016 17:45:00
Message: <web.57c0b8258629941b7a3e03fe0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "LanuHum" <Lan### [at] yandexru> wrote:
> > We have invented a bicycle.
>
> likely.  ;)
>
Tomorrow you will be asked to another location formula. The day after tomorrow
another. In each case the formula. Tired, you want to relax.
I have shown in the screenshots universal way: image_map.
Draw Mandelbrot grayscale on any object - no problem. :)))))


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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