2 ms·
The Fibonacci sphere arrangement has the advantage that the point coordinates can be computed from a function, so you don't even need a lookup table to decode:
by 10000truths 5y ago
The Fibonacci sphere arrangement has the advantage that the point coordinates can be computed from a function, so you don't even need a lookup table to decode:
def fibonacci_sphere_point(idx, num_points):
i = idx + 0.5
phi = math.acos(1 - 2 * i / num_points)
golden_ratio = (1 + 5 ** 0.5) / 2
theta = 2 * math.pi * i / golden_ratio
sin_phi = math.sin(phi)
cos_phi = math.cos(phi)
sin_theta = math.sin(theta)
cos_theta = math.cos(theta)
return (
cos_theta * sin_phi,
sin_theta * sin_phi,
cos_phi,
)
If you're willing to forgo using a spatial acceleration structure and instead do an O(n) scan for encoding, then you can get O(1) space complexity.
- alanbernstein 5y agoAhh, I get it, neat.