The transformation code to convert from Galactocentric left-handed Cartesian coordinates (ie. coordinates with an origin at the Galactic Center and X positive in the direction of the Sun) to the Sgr frame can be obtained by application of a standard rotation matrix. Under the "x-convention", the Eulerian rotation angles for the solar-centered sytem are (&Phi,&theta,&psi) = (183.75,76.54,194.11), and (183.75,76.54,201.60) for the GC centered system.
Download the transformation code here. This code may be used freely, but this website must be acknowledge as the source (see copyright section). Note that this code has been updated in January 2010: previous editions of the code defined Z_SGR positive in the direction of the Sgr antipole. This has now been fixed, and both Z_SGR and &Beta are positive in the direction of the orbital pole.
This file is in the format of a C++ header file, which contains functions to convert from standard Galactic
coordinate frames into the Sgr longitudinal coordinates. Include this header file in your code with the
include statement:
#include "SgrCoord.h"
This will enable you to make function calls to the coordinate conversion routines. Again, note that the input XYZ
is in GALACTOCENTRIC LEFT-HANDED coordinates.