Even distrubution of spherical points

I need to evenly distribute the points on a sphere, similar to KangarooPhysics in Grasshopper, as opposed to the image, where the points become increasingly dense. Any suggestions how to achieve this?

TBH, I have no concrete idea how to do this in Dynamo, or whether a method for this already exists, but your post made me curious. So, I googled just to see what was out there. I came across this Stack Exchange post that outlines a general algorithm that might work. I’d be interested to see if someone could implement this in Dynamo with some Python or Designscript.

Good luck!

My initial plan was to first create a range of points, and then somehow even out the distance between them, but I am starting to realise that it would be easier to generate them correctly from the start. I am now studying various math forums and trying to work out a Python script to generate equidistributed points at a given radius and amount.
I appreciate your input. I haven’t quite figured out how to apply it yet, but it seems to be a promising approach

@sebastianjust.jensen

Try this

image

2 Likes

Apparently one of the easiest ways to approximate this is to wrap a spline around a sphere and divide it into equal parts:

2 Likes

another way, if this is what you mean by ‘evenly distribute’

3 Likes

That is a very beautiful solution, Dimitar! Having said that, I would love to work out an algebraic approach to this issue, as I will be running this on -occasionally- hundreds of points at a time. And also out of general interest :slight_smile:

Yes, that is exactly what I meant! However, I would prefer not to have to generate solid geometry if I can help it

As stated, @sebastianjust.jensen I think you got an approach here: https://www.cmu.edu/biolphys/deserno/pdf/sphere_equi.pdf

Now programming it in Dynamo however, I’ll leave up to you! :wink: (or others…)

Yes, I know, and thank you, @jostein_olsen :slight_smile:

This is how far I have gotten, and while it does resemble a sphere to some extend, it certainly still needs some adjustments. I’m testing with 5000 points, as per the article in which the algorithm supposedly results in 4999. I am currently producing 62 and 95 angles respectively in the Python script, which I then cross-product to 5890 points. I am quite certain that it is mainly my Python script that is off, but I have yet to figure out how.

import math
r = IN[0] #radius
n = IN[1] #amount of points

a = 4 * math.pi * r ** 2 / n
d = math.sqrt(a)

mth = int(round(math.pi/d,0))

dth = math.pi/mth
dph = a/dth

thlist = []
philist = []

for m in range(0, mth-1):

	th = math.pi * (m + 0.5) / mth
	mph = int(round(2 * math.pi * math.sin(th / dph)))
	thlist.append(th)
	
	for i in range(0, mph-1):
	
		phi = 2 * math.pi * i / mph
		philist.append(phi)
		
		
OUT = thlist,philist
1 Like