The question is in two parts, the simple case where solution is available, and more complex case where I would like some help figuring it out:
The simple case: $$(r,\alpha,\beta) = \left(\sqrt{x^2+y^2+z^2}, \arccos(z/r), \arctan2(y,x)\right)$$
And: $$(x,y,z) = \left( r \sin(\alpha) \cos(\beta), r\sin(\alpha)\sin(\beta), r\cos(\alpha) \right) $$
The simple case works based on distance function $r : R \times R \times R \rightarrow R$. It has the good property that $\alpha$ and $\beta$ separates angles and can be used to generate polygons for opengl rendering - but I'm only getting spheres out from that... Now the more complex case should be similar but with different distance function, but the $\alpha$ and $\beta$ for more complex functions is difficult to figure out.
Example of more complex distance function(ideally going upto any isosurfaces): $$ r = \sqrt{x²+y^2+z^2} + \sqrt{(x-x_1)^2+(y-y_1)^2+(z-z_1)^2} $$
From this kind of complex distances which are of form $r : R \times R \times R \rightarrow R$, how can the $\alpha$ and $\beta$ be found which matches the distance?