Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7621279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:09:29+00:00 2026-05-31T04:09:29+00:00

I need an algorithm that can give me positions around a sphere for N

  • 0

I need an algorithm that can give me positions around a sphere for N points (less than 20, probably) that vaguely spreads them out. There’s no need for “perfection”, but I just need it so none of them are bunched together.

  • This question provided good code, but I couldn’t find a way to make this uniform, as this seemed 100% randomized.
  • This blog post recommended had two ways allowing input of number of points on the sphere, but the Saff and Kuijlaars algorithm is exactly in psuedocode I could transcribe, and the code example I found contained “node[k]”, which I couldn’t see explained and ruined that possibility. The second blog example was the Golden Section Spiral, which gave me strange, bunched up results, with no clear way to define a constant radius.
  • This algorithm from this question seems like it could possibly work, but I can’t piece together what’s on that page into psuedocode or anything.

A few other question threads I came across spoke of randomized uniform distribution, which adds a level of complexity I’m not concerned about. I apologize that this is such a silly question, but I wanted to show that I’ve truly looked hard and still come up short.

So, what I’m looking for is simple pseudocode to evenly distribute N points around a unit sphere, that either returns in spherical or Cartesian coordinates. Even better if it can even distribute with a bit of randomization (think planets around a star, decently spread out, but with room for leeway).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:09:30+00:00Added an answer on May 31, 2026 at 4:09 am

    In this example code node[k] is just the kth node. You are generating an array N points and node[k] is the kth (from 0 to N-1). If that is all that is confusing you, hopefully you can use that now.

    (in other words, k is an array of size N that is defined before the code fragment starts, and which contains a list of the points).

    Alternatively, building on the other answer here (and using Python):

    > cat ll.py
    from math import asin
    nx = 4; ny = 5
    for x in range(nx):
        lon = 360 * ((x+0.5) / nx)
        for y in range(ny):                                                         
            midpt = (y+0.5) / ny                                                    
            lat = 180 * asin(2*((y+0.5)/ny-0.5))                                    
            print lon,lat                                                           
    > python2.7 ll.py                                                      
    45.0 -166.91313924                                                              
    45.0 -74.0730322921                                                             
    45.0 0.0                                                                        
    45.0 74.0730322921                                                              
    45.0 166.91313924                                                               
    135.0 -166.91313924                                                             
    135.0 -74.0730322921                                                            
    135.0 0.0                                                                       
    135.0 74.0730322921                                                             
    135.0 166.91313924                                                              
    225.0 -166.91313924                                                             
    225.0 -74.0730322921                                                            
    225.0 0.0                                                                       
    225.0 74.0730322921                                                             
    225.0 166.91313924
    315.0 -166.91313924
    315.0 -74.0730322921
    315.0 0.0
    315.0 74.0730322921
    315.0 166.91313924
    

    If you plot that, you’ll see that the vertical spacing is larger near the poles so that each point is situated in about the same total area of space (near the poles there’s less space “horizontally”, so it gives more “vertically”).

    This isn’t the same as all points having about the same distance to their neighbours (which is what I think your links are talking about), but it may be sufficient for what you want and improves on simply making a uniform lat/lon grid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for an efficient algorithm that can give me all the edges of
I need an example algorithm that will draw pixels one at a time on
A friend was in need of an algorithm that would let him loop through
I need a binary search algorithm that is compatible with the C++ STL containers,
I need a cross-platform library/algorithm that will convert between 32-bit and 16-bit floating point
Need a running (moving, rolling) average algorithm to calculate the 5-minute average bits that
I'm completely new to the k-nearest neighbor classifier algorithm. Can someone please give me
This really, really urks me, so I hope that someone can give me a
Can anyone give me a good explanation for what the parameter algorithm does in
I need an algorithm to determine if a sentence, paragraph or article is negative

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.