Documentation / @interstellar-tools/equations / galactocentricPosition
Function: galactocentricPosition()
function galactocentricPosition(
direction: GalacticDirectionInterface,
distance: DistanceInterface,
options?: GalactocentricPositionOptionsInterface
): PositionInterface;Defined in: galactic/galactocentric-position.ts:90
The position around the Milky Way's centre of something seen from the Sun: turns a direction in galactic coordinates and a distance, as GALAXIES in @interstellar-tools/constants gives them, into 'galactocentric' frame.
The frame is Astropy's Galactocentric: x points from the Sun towards the centre, y in the direction the Sun moves around it (galactic longitude 90°), and z to the galaxy's north pole. From the Sun's position in galactic coordinates,
the plane is tilted by
Notes
- The centre is where Astropy puts it: at
towards galactic longitude and latitude 0°, the IAU's galactic centre, 4.3′ (10.5 pc) from Sagittarius A*. - It matches Astropy's transform from right ascension and declination to about 2 parts in a million of the distance, the size of the difference between the IAU's galactic coordinates and Astropy's centre.
- The Sun itself, at distance 0, is at
.
Parameters
| Parameter | Type | Description |
|---|---|---|
direction | GalacticDirectionInterface | The direction from the Sun: galactic longitude l and latitude b, in degrees. |
distance | DistanceInterface | The distance from the Sun. |
options? | GalactocentricPositionOptionsInterface | The unit of the result, and the Sun's place, if not the defaults. |
Returns
The position in the 'galactocentric' frame, in options.unit or the unit of distance.
Throws
If an angle or a distance isn't finite, b is outside −90° to 90°, distance is negative, or the Sun's height isn't less than its distance from the centre.
Example
import { GALAXIES } from '@interstellar-tools/constants';
import { galactocentricPosition } from '@interstellar-tools/equations';
const andromeda = GALAXIES.find((galaxy) => galaxy.id === 'andromeda')!;
const position = galactocentricPosition(
andromeda.direction!,
andromeda.distance,
{ unit: 'kpc' }
);
console.log(position.x.value, position.y.value, position.z.value); // ≈ -375.31 605.50 -278.87See
https://docs.astropy.org/en/stable/coordinates/galactocentric.html Astropy: the Galactocentric frame