Last active
August 29, 2015 14:08
-
-
Save larsberg/960cb199405387d585dd to your computer and use it in GitHub Desktop.
get ofVec3f on sphere using
This file contains hidden or 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
//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