3

To distribute point evenly on a unit sphere, the answer uses a Fibonacci spiral that maintains constant surface area.

Is it now possible to use a similar method to distribute points evenly on a unit hemisphere without rejecting points? Taking the absolute value like

cos_theta = abs(((i * offset) - 1) + (offset / 2))

does not work as it seems to cluster the points in pairs.

Community
  • 1
  • 1
Matthias
  • 4,481
  • 12
  • 45
  • 84
  • 1
    see [sphere triangulation](http://stackoverflow.com/a/29139125/2521214) just init the mesh with its half. also the linked Q/A provides additional methods to solve this ... – Spektre Dec 17 '15 at 07:16
  • @Spektre sphere triangulation is also an option I considered, it is easier to reason about but the overhead of tesselating the sphere seems larger – Matthias Dec 17 '15 at 08:55
  • 1
    There are also 2 links (http://stackoverflow.com/a/25031737/2521214) with different approach similar to yours but without spiral exploiting spherical coordinates and circle circumference... – Spektre Dec 17 '15 at 16:23

1 Answers1

4

The y values loop from -1+1/samples to 1-1/samples by means of the for loop:

for i in range(samples):
    y = ((i * offset) - 1) + (offset / 2)

You want to loop from 0+1/samples to 1-1/samples. Simply skip the first sample/2 iterations:

for i in range(samples / 2, samples):
    y = ((i * offset) - 1) + (offset / 2)

Of course it is cleaner to now rewrite the expressions a bit, such that you loop from 0 to samples' again, but this should be a good starting point for more refactoring.

Matthias
  • 4,481
  • 12
  • 45
  • 84
Vincent van der Weele
  • 12,927
  • 1
  • 33
  • 61