Skip to content

Instantly share code, notes, and snippets.

@larsberg
Last active August 29, 2015 14:08
Show Gist options
  • Save larsberg/960cb199405387d585dd to your computer and use it in GitHub Desktop.
Save larsberg/960cb199405387d585dd to your computer and use it in GitHub Desktop.
get ofVec3f on sphere using
//theta in [0,TWO_PI), phi in [0,PI], and where radius in [0,infty)
static ofVec3f pointOnSphere(float theta, float phi, float radius = 50)
{
ofVec3f p;
p.x = radius * cos(theta) * sin(phi);
p.y = radius * cos(phi);
p.z = radius * sin(theta) * sin(phi);
return p;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment