RA/Dec + Distance -> (x, y, z)

For those who’ve never heard of Rright Ascension (RA) and Declination (Dec), they’re the celestial equivalents of longitude and latitude respectively.

Anyways, I’m trying to figure out some function to convert a set of coordinates and a distance into a set of 3D coordinates (x, y, z) where an object can be drawn.

I think this might just require some simple Algebra to do but at this point, I can’t really think hard on this subject. If I come up with something, I’ll reply here with a solution.

Thanks…the function can be in any language though I’d prefer C.

Something like that ?
http://en.wikipedia.org/wiki/Polar_coordinates#Spherical_coordinates