I have a program in 2D (from this forum) and want to make it work 3D.
In 2D I have a circle and when you move the mouse to the left and to the right, the changing X-value of the mouse draws a line from the circles center to a point on the circumference (a radius is drawn).
I now want to do this in 3D: I have an imagined sphere. Imagine when I move the mouse to the left and to the right and the changing X-value (phi) of the mouse is the position on the equator of my sphere (seen from above).
I now want the Y-value of the mouse to be the other angle (phiUP) going straight up from the equator. So let say you moved your mouse' X on the equator to central america and now you move the mouse up (Y) you go over California to alasca etc. over the pole all the way back to your starting point.
Anyway, my maths fail me. I have
AddZ = factor*cos(phiUP);
which is nothing. Any help appreciated. And, no, I don't want to use quaternions, thanks.
// draws a radial line in a circle / sphere // according to the mouse, X-value for horizontal, // Y-value vertically.
int mouseX1; int mouseY1;
int mouseX2; int mouseY2;
// angles float phi; // horizontal (x,y) float phiUP; // vertically UP and Down