I have already addressed equatorial coordinates, so will now focus on galactic coordinates.

The galactic coordinate system is the coordinate system based on the plane of the Milky Way galaxy, which, on a clear night can be seen arching across the sky.

Galactic coordinates are particularly useful when studying objects pertaining to the Milky Way galaxy itself as opposed to our local galactic neighbourhood, and would include objects such as globular clusters or supernovae.

The galactic longitude is denoted by ℓ and the galactic latitude by b. The galactic longitude is measured from the galactic centre, and is in the range of 0°-360°, using the Sun as the centre of the celestial sphere. The galactic latitude is in the range -90° – 90° with the galactic poles being perpentidular to the galactic plane.

To convert between the equatorial and galactic systems, we need the right ascension and declination of the galactic north pole, as well as the ascending node of the milky way, which is the point (in degrees) where the galactic plane crosses the equatorial plane.

For the Milky Way, the right ascension is 192.25° and the declination is 27.4°, with the ascending node being 33°.

		public static void ConvEquToGal(double fGalNPRA, double fGalNPDecl, double fGalPlaneAscNode, double fRA, double fDecl, ref double fL, ref double fB)
		{
			double fSinB;
			double fX;
			double fY;
			double fRADiff;

			fGalNPRA = fGalNPRA * 15;
			fRA = fRA * 15;

			fGalNPRA = Trig.DegToRad(fGalNPRA);
			fGalNPDecl = Trig.DegToRad(fGalNPDecl);
			fRA = Trig.DegToRad(fRA);
			fDecl = Trig.DegToRad(fDecl);
			fRADiff = fRA - fGalNPRA;
			fSinB = (Math.Cos(fDecl) * Math.Cos(fGalNPDecl) * Math.Cos(fRADiff)) + (Math.Sin(fDecl) * Math.Sin(fGalNPDecl));
			fB = Math.Asin(fSinB);
			fY = (Math.Sin(fDecl)) - (Math.Sin(fB) * Math.Sin(fGalNPDecl));
			fX = (Math.Cos(fDecl) * Math.Sin(fRADiff) * Math.Cos(fGalNPDecl));
			fL = Math.Atan(fY / fX);
			fL = Trig.RadToDeg(fL);
			fB = Trig.RadToDeg(fB);
			fL = Trig.TanQuadrant(fX, fY, fL);
			fL = fL + fGalPlaneAscNode;
			fL = Trig.PutIn360Deg(fL);
		}

		public static void ConvGalToEqu(double fGalNPRA, double fGalNPDecl, double fGalPlaneAscNode, double fL, double fB, ref double fRA, ref double fDecl)
		{
			double fSinDecl;
			double fX;
			double fY;
			double fLDiff;

			fGalNPRA = fGalNPRA * 15;

			fGalPlaneAscNode = Trig.DegToRad(fGalPlaneAscNode);
			fGalNPDecl = Trig.DegToRad(fGalNPDecl);
			fL = Trig.DegToRad(fL);
			fB = Trig.DegToRad(fB);

			fLDiff = fL - fGalPlaneAscNode;
			fSinDecl = (Math.Cos(fB) * Math.Cos(fGalNPDecl) * Math.Sin(fLDiff)) + (Math.Sin(fB) * Math.Sin(fGalNPDecl));
			fDecl = Math.Asin(fSinDecl);
			fY = (Math.Cos(fB) * Math.Cos(fLDiff));
			fX = (Math.Sin(fB) * Math.Cos(fGalNPDecl)) - (Math.Cos(fB) * Math.Sin(fLDiff) * Math.Sin(fGalNPDecl));
			fRA = Math.Atan(fY / fX);
			fRA = Trig.RadToDeg(fRA);
			fDecl = Trig.RadToDeg(fDecl);
			fRA = Trig.TanQuadrant(fX, fY, fRA);
			fRA = fRA + fGalNPRA;
			fRA = Trig.PutIn360Deg(fRA);

			fRA = fRA / 15.0;
		}
Share