Created
April 6, 2011 04:30
-
-
Save onedayitwillmake/905133 to your computer and use it in GitHub Desktop.
Uniformly distributed points on a sphere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float theta = M_PI * (3.0 - sqrtf(5.0)); | |
float o = 2.0f / count; | |
float radius = 1500; | |
for(int i = 0; i < count; ++i) | |
{ | |
float y = i * o - 1 + (o / 2); | |
float r = sqrtf(1 - y*y); | |
float phi = i * theta; | |
ci::Vec3f pos = ci::Vec3f( cosf(phi)*r, y, sinf(phi)*r) * radius; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment