LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Random unit vector (x0, y0, z0) generating

Solved!
Go to solution

Yes, you are right ... I confused them.

0 Kudos
Message 21 of 26
(1,540 Views)

Recall that the task was to generate a random unit vector in 3D.  3D implies 3 degrees of freedom, but "unit vector" constraint reduces the degrees of freedom by one -- it's not the sphere, but the surface of the sphere.  Hence two parameters (often called "theta" (0 to 2pi) and "phi" (0 to pi) suffice.  Note that phi does not need to go to two pi to get the "southern hemisphere".

 

Bob Schor

0 Kudos
Message 22 of 26
(1,523 Views)

In my interpretation (please see the poste above):

  • theta (zenith): 0 ... pi
  • phi (azimuth): 0 ... 2pi

Sure, zenith doesn't need to go over pi (if I properly understood your remark)

0 Kudos
Message 23 of 26
(1,507 Views)

For Extra Credit, generate N points "randomly" distributed over the surface of a sphere.  In particular, the points should not "clump" at the equator or poles.  Hint -- theta (azimuth) is still uniformly distributed over 0 .. 2pi, and phi (elevation) still ranges from 0 .. pi (or -pi/2 to pi/2), but isn't quite uniform ...

 

Bob Schor

Message 24 of 26
(1,501 Views)

@Pavel_47 wrote:

In my interpretation (please see the poste above):

  • theta (zenith): 0 ... pi
  • phi (azimuth): 0 ... 2pi

Sure, zenith doesn't need to go over pi (if I properly understood your remark)


Pavel -- I agree with you, the comment was meant for an earlier responder who commented on GerdW's post ...

 

BS

0 Kudos
Message 25 of 26
(1,488 Views)

@Bob_Schor wrote:

For Extra Credit, generate N points "randomly" distributed over the surface of a sphere.  In particular, the points should not "clump" at the equator or poles.  Hint -- theta (azimuth) is still uniformly distributed over 0 .. 2pi, and phi (elevation) still ranges from 0 .. pi (or -pi/2 to pi/2), but isn't quite uniform ...

 

Bob Schor


That is an excellent point Bob, and in my opinion it is not extra credit, but part of the original question!

Spoiler
theta = 2*pi*u
phi = acos(2*v-1)

where u and v are uniform over (0,1)

 

0 Kudos
Message 26 of 26
(1,477 Views)