I am trying to move some particles on the surface of the sphere, so I need to calculate those positions in update() and succeed it, so far.
The way of calculation is just to use sin and cos function.
It’s like the following code.
//position of particle
degree.x = ofRandom(0, 360);
degree.y = ofRandom(-90, 90);
degree.z = degree.x;
// velocity for moving the particle
vec.set(0.01, 1.0, 1.0);
void update() {
degree += vec;
radius = cos(degree.y * DEG_TO_RAD);
pos.x = ( cos(degree.x * DEG_TO_RAD) * radius * scale );
pos.y = ( sin(degree.y * DEG_TO_RAD) * scale );
pos.z = ( sin(degree.z * DEG_TO_RAD) * radius * scale );
}
Now, I just know the existence of ofQuaternion class.
Can I calculate each position on the sphere or Not ?
Thanks.