Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

In a Monte Carlo simulation i have encountered the following problem: given a unity vector u defining a point A on the surface of a unity sphere, i must randomly determine a new vector forming an angle θ in [0,max) with the initial vector. In other words, i need an algorithm that randomly chooses, out of a uniform distribution, a point on the surface of the sphere inside a circle on the sphere with predefined radius centered at the initial point A.

I was thinking of making a coordinates rotation from (x,y,z) to (X,Y,Z) using Euler angles (θ,Ψ,φ), such that Z=u. Then, a transformation from Cartesian coordinates to spherical coordinates (r,θ,φ) where u=(1,0,0) and uniformly choose cosθ and φ. Last, make the transformation to (X,Y,Z) and then to (x,y,z). But, trigonometric functions are too slow, is there any faster way?

Could Marsaglia method for uniformly distributed points on the surface of a sphere be modified so as to choose points in the vicinity of a point?

Thanks in advance for any suggestions.

share|improve this question
1  
related - if not dup: math.stackexchange.com/questions/214358/… –  leonbloy Oct 16 '12 at 11:45
    
Maybe the Von Mises-Fisher distribution can be adapted to this... –  J. M. Jun 1 '13 at 4:13

1 Answer 1

If the initial point is $A=(a,b,c)$ and if $M=(x,y,z)$ is uniformly distributed on the sphere, one wants to keep $M$ if and only if $ax+by+cz\geqslant\cos(\theta_{\max})$.

share|improve this answer
    
Nice solution, very easy to implement, but i am afraid not very computationally efficient, especially for small angles Θmax, as it will need many retries to finally get the right point. We could double the speed though by also choosing M=(-x,-y-z) if ax+by+cz<-cos(Θmax). –  Andreas M. Oct 16 '12 at 17:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.