Suppose you want to divide a numeric range (such as 0–1 or 0–23 or 1–365) into even segments. If you know how many segments you have, it's easy; you divide by N. But if you don't know how many segments you will have, and you can't go back once you've divided something, it gets trickier. If you divide into 3 equal segments and need 3, you're at the optimal point. But if you instead need 4 and have already divided into 3 segments, you end up subdividing one segment of length 1/3 into 2, leaving you with 4 segments of length 1/6, 1/6, 1/3, and 1/3.
There's a clever division scheme involving the golden ratio:
- Rescale your range to be from 0–1.
- The ith division occurs at i * φ
It's so simple. Why does this work? I don't know. But it's pretty neat.
I first ran across this when I was looking for a way to pick sample points in 1 year of data. I wanted a set that would be roughly evenly spaced, because I wanted to draw a timeseries chart with the results, but I didn't know how much time it would take to analyze the points. So I analyzed one at a time, using the golden ratio to guide me.
Comments:
If the i th division is given by phi * i, would be greater than 1, wouldn't it? Where would that slice in your rescaled range of 0-1?
Also, this still leaves the problem of *uneven* slices.
They're still uneven but it's unavoidable. This scheme leaves them as even as possible (I think) given the constraint that they need to be roughly even after each division.
Just wanted to let you know that over the years I have found some of the material on your website really useful. I am a hobbyist game programmer(wannabe is more like it) but I really enjoy reading some of your articles on pathfinding etc.
BTW how is supreme commander:D Have to upgrade my system to handle the damn game.
See:
Stephen Wolfram, "A new kind of science" §8.6 at http://www.wolframscience.com/nksonline/toc.html
http://en.wikipedia.org/wiki/Golden_angle
http://en.wikipedia.org/wiki/Fermat%27s_spiral

