Is there a way to generate a uniformly distributed point on a sphere from a fixed amount of random real numbers? The 2019 Stack Overflow Developer Survey Results Are InHow to find a random axis or unit vector in 3D?Picking random points in the volume of sphere with uniform probabilityIs a sphere a closed set?Random Point Sampling From a Set with Certain GeometryHow to Create a Plane Inside A CubeAlgorithm to generate random points in n-Sphere?Sampling on Axis-Aligned Spherical QuadRandom 3D points uniformly distributed on an ellipse shaped window of a sphereCompensating for distortion when projecting a 2D texture onto a sphereFind the relative radial position of a point within an ellipsoid

What do these terms in Caesar's Gallic Wars mean?

Why doesn't shell automatically fix "useless use of cat"?

How come people say “Would of”?

I am an eight letter word. What am I?

The phrase "to the numbers born"?

If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?

The difference between dialogue marks

Old scifi movie from the 50s or 60s with men in solid red uniforms who interrogate a spy from the past

Ubuntu Server install with full GUI

Can withdrawing asylum be illegal?

Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?

What do hard-Brexiteers want with respect to the Irish border?

What is the most efficient way to store a numeric range?

Why doesn't UInt have a toDouble()?

Why are there uneven bright areas in this photo of black hole?

What is the motivation for a law requiring 2 parties to consent for recording a conversation

Keeping a retro style to sci-fi spaceships?

Are there any other methods to apply to solving simultaneous equations?

How to obtain a position of last non-zero element

Dropping list elements from nested list after evaluation

How to notate time signature switching consistently every measure

Unitary representations of finite groups over finite fields

Is it a good practice to use a static variable in a Test Class and use that in the actual class instead of Test.isRunningTest()?

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?



Is there a way to generate a uniformly distributed point on a sphere from a fixed amount of random real numbers?



The 2019 Stack Overflow Developer Survey Results Are InHow to find a random axis or unit vector in 3D?Picking random points in the volume of sphere with uniform probabilityIs a sphere a closed set?Random Point Sampling From a Set with Certain GeometryHow to Create a Plane Inside A CubeAlgorithm to generate random points in n-Sphere?Sampling on Axis-Aligned Spherical QuadRandom 3D points uniformly distributed on an ellipse shaped window of a sphereCompensating for distortion when projecting a 2D texture onto a sphereFind the relative radial position of a point within an ellipsoid










3












$begingroup$


The obvious solution of Lattitude & Longitude doesn't work because it generates points more densely near the poles, and the other thing I came up with (Pick a random point in the unit cube, if it's in the sphere map it to the surface, and restart if it's outside) doesn't always find a point within a fixed number of tries.










share|cite|improve this question











$endgroup$











  • $begingroup$
    So what you want is a uniform distribution. It would be helpful to state this explicitly.
    $endgroup$
    – robjohn
    3 hours ago






  • 1




    $begingroup$
    Distribute longitude uniformly and the sine of the latitude uniformly. Then the distribution of points on the sphere will be uniform.
    $endgroup$
    – robjohn
    3 hours ago










  • $begingroup$
    @robjohn thank you, you're right that I forgot to specify that.
    $endgroup$
    – The Zach Man
    47 mins ago















3












$begingroup$


The obvious solution of Lattitude & Longitude doesn't work because it generates points more densely near the poles, and the other thing I came up with (Pick a random point in the unit cube, if it's in the sphere map it to the surface, and restart if it's outside) doesn't always find a point within a fixed number of tries.










share|cite|improve this question











$endgroup$











  • $begingroup$
    So what you want is a uniform distribution. It would be helpful to state this explicitly.
    $endgroup$
    – robjohn
    3 hours ago






  • 1




    $begingroup$
    Distribute longitude uniformly and the sine of the latitude uniformly. Then the distribution of points on the sphere will be uniform.
    $endgroup$
    – robjohn
    3 hours ago










  • $begingroup$
    @robjohn thank you, you're right that I forgot to specify that.
    $endgroup$
    – The Zach Man
    47 mins ago













3












3








3


1



$begingroup$


The obvious solution of Lattitude & Longitude doesn't work because it generates points more densely near the poles, and the other thing I came up with (Pick a random point in the unit cube, if it's in the sphere map it to the surface, and restart if it's outside) doesn't always find a point within a fixed number of tries.










share|cite|improve this question











$endgroup$




The obvious solution of Lattitude & Longitude doesn't work because it generates points more densely near the poles, and the other thing I came up with (Pick a random point in the unit cube, if it's in the sphere map it to the surface, and restart if it's outside) doesn't always find a point within a fixed number of tries.







geometry






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited 28 mins ago









robjohn

271k27313642




271k27313642










asked 3 hours ago









The Zach ManThe Zach Man

1057




1057











  • $begingroup$
    So what you want is a uniform distribution. It would be helpful to state this explicitly.
    $endgroup$
    – robjohn
    3 hours ago






  • 1




    $begingroup$
    Distribute longitude uniformly and the sine of the latitude uniformly. Then the distribution of points on the sphere will be uniform.
    $endgroup$
    – robjohn
    3 hours ago










  • $begingroup$
    @robjohn thank you, you're right that I forgot to specify that.
    $endgroup$
    – The Zach Man
    47 mins ago
















  • $begingroup$
    So what you want is a uniform distribution. It would be helpful to state this explicitly.
    $endgroup$
    – robjohn
    3 hours ago






  • 1




    $begingroup$
    Distribute longitude uniformly and the sine of the latitude uniformly. Then the distribution of points on the sphere will be uniform.
    $endgroup$
    – robjohn
    3 hours ago










  • $begingroup$
    @robjohn thank you, you're right that I forgot to specify that.
    $endgroup$
    – The Zach Man
    47 mins ago















$begingroup$
So what you want is a uniform distribution. It would be helpful to state this explicitly.
$endgroup$
– robjohn
3 hours ago




$begingroup$
So what you want is a uniform distribution. It would be helpful to state this explicitly.
$endgroup$
– robjohn
3 hours ago




1




1




$begingroup$
Distribute longitude uniformly and the sine of the latitude uniformly. Then the distribution of points on the sphere will be uniform.
$endgroup$
– robjohn
3 hours ago




$begingroup$
Distribute longitude uniformly and the sine of the latitude uniformly. Then the distribution of points on the sphere will be uniform.
$endgroup$
– robjohn
3 hours ago












$begingroup$
@robjohn thank you, you're right that I forgot to specify that.
$endgroup$
– The Zach Man
47 mins ago




$begingroup$
@robjohn thank you, you're right that I forgot to specify that.
$endgroup$
– The Zach Man
47 mins ago










2 Answers
2






active

oldest

votes


















4












$begingroup$

The Lambert cylindrical equal area projection maps the sphere to a cylinder, area to equal area. It is easy to generate a uniform distribution on a cylinder. Simply map it back to the sphere.



For $(u_1,u_2)$ uniform on $[0,1]^2$, either



$mathrmlat=arcsin(2u_1-1),mathrmlon=2pi u_2$



or



$z=2u_1-1,x=sqrt1-z^2cos(2pi u_2),y=sqrt1-z^2sin(2pi u_2)$






share|cite|improve this answer









$endgroup$




















    3












    $begingroup$

    Your method, even though it doesn't finish in a fixed number of times, is a reasonable way to do it. Each trial succeeds with probability $fracpi6$, which is better than $frac12$: the average number of trials is less than $2$.



    Another standard method is to use the normal distribution. Generate $x, y, z$ independently from a standard normal distribution, then take the point $(x,y,z)$ and divide it by $sqrtx^2+y^2+z^2$ as you did for points inside the cube. The multivariate normal distribution is rotationally symmetric, so this will get you evenly distributed points on the sphere.



    (The Box–Muller transform is one way to generate normally distributed random numbers, and some versions of it do not use rejection sampling, so they can be done with a "fixed amount" of randomness.)






    share|cite|improve this answer









    $endgroup$













      Your Answer





      StackExchange.ifUsing("editor", function ()
      return StackExchange.using("mathjaxEditing", function ()
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      );
      );
      , "mathjax-editing");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "69"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3184449%2fis-there-a-way-to-generate-a-uniformly-distributed-point-on-a-sphere-from-a-fixe%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      4












      $begingroup$

      The Lambert cylindrical equal area projection maps the sphere to a cylinder, area to equal area. It is easy to generate a uniform distribution on a cylinder. Simply map it back to the sphere.



      For $(u_1,u_2)$ uniform on $[0,1]^2$, either



      $mathrmlat=arcsin(2u_1-1),mathrmlon=2pi u_2$



      or



      $z=2u_1-1,x=sqrt1-z^2cos(2pi u_2),y=sqrt1-z^2sin(2pi u_2)$






      share|cite|improve this answer









      $endgroup$

















        4












        $begingroup$

        The Lambert cylindrical equal area projection maps the sphere to a cylinder, area to equal area. It is easy to generate a uniform distribution on a cylinder. Simply map it back to the sphere.



        For $(u_1,u_2)$ uniform on $[0,1]^2$, either



        $mathrmlat=arcsin(2u_1-1),mathrmlon=2pi u_2$



        or



        $z=2u_1-1,x=sqrt1-z^2cos(2pi u_2),y=sqrt1-z^2sin(2pi u_2)$






        share|cite|improve this answer









        $endgroup$















          4












          4








          4





          $begingroup$

          The Lambert cylindrical equal area projection maps the sphere to a cylinder, area to equal area. It is easy to generate a uniform distribution on a cylinder. Simply map it back to the sphere.



          For $(u_1,u_2)$ uniform on $[0,1]^2$, either



          $mathrmlat=arcsin(2u_1-1),mathrmlon=2pi u_2$



          or



          $z=2u_1-1,x=sqrt1-z^2cos(2pi u_2),y=sqrt1-z^2sin(2pi u_2)$






          share|cite|improve this answer









          $endgroup$



          The Lambert cylindrical equal area projection maps the sphere to a cylinder, area to equal area. It is easy to generate a uniform distribution on a cylinder. Simply map it back to the sphere.



          For $(u_1,u_2)$ uniform on $[0,1]^2$, either



          $mathrmlat=arcsin(2u_1-1),mathrmlon=2pi u_2$



          or



          $z=2u_1-1,x=sqrt1-z^2cos(2pi u_2),y=sqrt1-z^2sin(2pi u_2)$







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered 1 hour ago









          robjohnrobjohn

          271k27313642




          271k27313642





















              3












              $begingroup$

              Your method, even though it doesn't finish in a fixed number of times, is a reasonable way to do it. Each trial succeeds with probability $fracpi6$, which is better than $frac12$: the average number of trials is less than $2$.



              Another standard method is to use the normal distribution. Generate $x, y, z$ independently from a standard normal distribution, then take the point $(x,y,z)$ and divide it by $sqrtx^2+y^2+z^2$ as you did for points inside the cube. The multivariate normal distribution is rotationally symmetric, so this will get you evenly distributed points on the sphere.



              (The Box–Muller transform is one way to generate normally distributed random numbers, and some versions of it do not use rejection sampling, so they can be done with a "fixed amount" of randomness.)






              share|cite|improve this answer









              $endgroup$

















                3












                $begingroup$

                Your method, even though it doesn't finish in a fixed number of times, is a reasonable way to do it. Each trial succeeds with probability $fracpi6$, which is better than $frac12$: the average number of trials is less than $2$.



                Another standard method is to use the normal distribution. Generate $x, y, z$ independently from a standard normal distribution, then take the point $(x,y,z)$ and divide it by $sqrtx^2+y^2+z^2$ as you did for points inside the cube. The multivariate normal distribution is rotationally symmetric, so this will get you evenly distributed points on the sphere.



                (The Box–Muller transform is one way to generate normally distributed random numbers, and some versions of it do not use rejection sampling, so they can be done with a "fixed amount" of randomness.)






                share|cite|improve this answer









                $endgroup$















                  3












                  3








                  3





                  $begingroup$

                  Your method, even though it doesn't finish in a fixed number of times, is a reasonable way to do it. Each trial succeeds with probability $fracpi6$, which is better than $frac12$: the average number of trials is less than $2$.



                  Another standard method is to use the normal distribution. Generate $x, y, z$ independently from a standard normal distribution, then take the point $(x,y,z)$ and divide it by $sqrtx^2+y^2+z^2$ as you did for points inside the cube. The multivariate normal distribution is rotationally symmetric, so this will get you evenly distributed points on the sphere.



                  (The Box–Muller transform is one way to generate normally distributed random numbers, and some versions of it do not use rejection sampling, so they can be done with a "fixed amount" of randomness.)






                  share|cite|improve this answer









                  $endgroup$



                  Your method, even though it doesn't finish in a fixed number of times, is a reasonable way to do it. Each trial succeeds with probability $fracpi6$, which is better than $frac12$: the average number of trials is less than $2$.



                  Another standard method is to use the normal distribution. Generate $x, y, z$ independently from a standard normal distribution, then take the point $(x,y,z)$ and divide it by $sqrtx^2+y^2+z^2$ as you did for points inside the cube. The multivariate normal distribution is rotationally symmetric, so this will get you evenly distributed points on the sphere.



                  (The Box–Muller transform is one way to generate normally distributed random numbers, and some versions of it do not use rejection sampling, so they can be done with a "fixed amount" of randomness.)







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered 3 hours ago









                  Misha LavrovMisha Lavrov

                  49k757107




                  49k757107



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Mathematics Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3184449%2fis-there-a-way-to-generate-a-uniformly-distributed-point-on-a-sphere-from-a-fixe%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                      Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                      How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2