Sampling with multidimensional transformations

Click For Summary

Discussion Overview

The discussion revolves around generating ray directions from a point in three-dimensional space, specifically focusing on uniform and Gaussian distributions within a hemisphere. The context includes mathematical derivations for sampling points uniformly and within a solid angle, as well as the challenge of adapting these methods to produce a Gaussian distribution of ray directions.

Discussion Character

  • Exploratory
  • Mathematical reasoning
  • Technical explanation

Main Points Raised

  • One participant describes a method for generating a point uniformly distributed on a hemisphere using spherical coordinates and confirms the derivation with a textbook.
  • The same participant proposes a modified method for generating points within a small solid angle subtended by angle σ, providing a new formula for θ.
  • Another participant suggests using rejection sampling to adapt the uniform distribution method to a Gaussian distribution, noting that the effectiveness depends on the parameters involved.
  • A different approach is mentioned, proposing the generation of a random number based on a modified distribution that incorporates a Gaussian function.
  • There is a clarification regarding the role of sin(θ) as a weight for the Gaussian distribution, with a suggestion to define the Gaussian function in terms of θ.

Areas of Agreement / Disagreement

Participants express various methods for generating ray directions, but there is no consensus on the best approach for implementing a Gaussian distribution. The discussion includes multiple competing views and suggestions without resolution.

Contextual Notes

Participants do not fully agree on the specifics of the Gaussian distribution's implementation, and there are unresolved details regarding the parameters and definitions used in the proposed methods.

Cbas
Messages
4
Reaction score
0
I am not sure if I have the title right, but here is my problem:
I have a ray which 'should be' shot vertically from a point p, but depending on the situation it can: 1) either be shot in any direction in the hemisphere above p 2) shot with an angle of no more than σ off the vertical 3) shot with an angle of no more than σ off the vertical by with a Gaussian distribution
(See http://imgur.com/BMqWjoQ)
http://imgur.com/BMqWjoQ

First:
I wish to generate a point uniformly distributed on a hemisphere. I did some derivations and I came up with:
θ = acos(R1)
∅= 2∏R2
x = sinθcos∅=cos(2∏R2)sqrt(1-R12)
y = sinθsin∅=sin(2∏R2)sqrt(1-R12)
z=cosθ=R1
I confirmed this wit a textbook, So I am pretty sure its right---
Second:
I want to generate a point uniformly but only within a small solid angle subtended by angle σ
Similar derivation as before but the values for theta and phi are
θ=acos(1-(1-cos(σ)*R1))
∅= 2∏R2
Im pretty sure this is also right

Third:
(now this is where I need help)
Instead of using a uniform distribution I would like to use a Gaussian distribution. I know Box Muller is one way of generating random number with a normal distribution (given a set of canonical numbers) but how do I use that now to generate ray directions that are normally distributed?

Thanks for your help
 
Physics news on Phys.org
Can you do rejection sampling? The "best" implementation would depend on details of the parameters. "Use the second algorithm and reject the point with probablility 1-(value of gaussian)" should give reasonable results if the gaussian is not too narrow.

Alternatively, generate a random number based on the modified distribution f(θ)=sin(θ)*gaussian
 
mfb said:
Alternatively, generate a random number based on the modified distribution f(θ)=sin(θ)*gaussian

What do you mean by "gaussian"? Is that one of my gaussian random numbers?
I assume sin(theta) is measure of area
Area = ∫0σ0sin(θ) Z1dθd∅

(thanks for your reply)
 
sin(θ) is (proportional to) the length of a circle around the vertical axis. It is just a weight for the gaussian distribution. I don't know if you want that gaussian as function of θ, or the projection on the floor, or whatever, just use what you like there. As function of θ, it gets $$f(\theta)=\sin(\theta)\exp\left(\frac{-\theta^2}{2\sigma^2}\right)$$
Where σ is the width of the gaussian.
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 29 ·
Replies
29
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
12
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 41 ·
2
Replies
41
Views
10K
  • · Replies 34 ·
2
Replies
34
Views
4K