# Transforming Galactic Coordinates in Cartesian with Distance

Lets say I have galactic coordinates of an object, l and b.

I figured out that i can transform them to cartesian system using the formula:

\begin{align} X &= \cos(b)\cos(l)\\ Y &= \cos(b)\sin(l)\\ Z &= \sin(b) \end{align}

Giving me a vector on the celestial sphere. So far so good, now I want to know the exact position of the object. Using 1/parallax, I compute the distance. Therefore I multiply it with my vector to find out the exact cartesian position of the object.

\begin{align} X &= \textstyle\frac{1}{p} \cos(b)\cos(l)\\ Y &= \textstyle\frac{1}{p} \cos(b)\sin(l)\\ Z &= \textstyle\frac{1}{p} \sin(b) \end{align} What I want to know is if this calculation is correct and if not, what do I have to change or reconsider? Thanks!

• The question for me is : what problem do you solve by conversion from galactic to (which?) Cartesian coordinates? Galactic coordinates or heliocentric seem more appropriate when dealing with galactic objects Mar 21, 2020 at 1:18
• I want to see how the planets are contributed in the cartesian coordinate system. The first transformation only gives me, from my understanding, the positions on the sphere. I want the exact positions with the distance from the centre. Mar 21, 2020 at 10:41
• If I'm understanding correctly, you're looking for precise distance from the center of the galaxy. Unfortunately, we don't know the distance to the center of the galaxy with high precision, so galactic coordinates are centered on our solar system's barycenter.
– user21
Mar 21, 2020 at 16:58
• I'm actually trying to do so from the barycenter. Is it possible that I should use the Radius of the sun instead of 1/P? Mar 21, 2020 at 17:32
• No, using parsecs is a good idea. The distance of most stars compared to the Sun's radius is very lage.
– user21
Apr 1, 2020 at 15:48