- Conversion among equatorial coordinate (right ascension and declination), horizontal coordinate (azimuth and altitude), ecliptic coordinate (longitude and latitude) and their corresponding Cartesian equivalents.
- Calculate Julian Day and Local sidereal time.
- High precision calculation of the obliquity of ecliptic good to 0″.04 / 1000 years over 10000 years.
- Matrix / Quaternion transformation from celestial coordinate system to local tangent plane. Supports North-East-Down coordinate from earth-centered, earth-fixed coordinate system for any given longitude, latitude and timestamp.
You can find a demo project under SpaceTimeDemo
directory.
It showcases several useful scenarios.
github "DJBen/SpaceTime" ~> 0.4.0
Equatorial to horizontal coordinate:
// Supply observer location and timestamp
let locTime = ObserverLocationTime(location: location, timestamp: JulianDay.now)
let vegaCoord = EquatorialCoordinate(rightAscension: radians(hours: 18, minutes: 36, seconds: 56.33635), declination: radians(degrees: 38, minutes: 47, seconds: 1.2802), distance: 1)
// Azimuth and altitude of Vega
let vegaAziAlt = HorizontalCoordinate.init(equatorialCoordinate: vegaCoord, observerInfo: locTime)
Ecliptic coordinate of Pollux at standard equinox of J2000.0.
let ra = DegreeAngle(116.328942)
let dec = DegreeAngle(28.026183)
let eclipticCoord = EclipticCoordinate(longitude: ra, latitude: dec, distance: 1, julianDay: .J2000)
eclipticCoord.longitude.wrappedValue // 113.21563
eclipticCoord.latitude.wrappedValue // 6.68417
Greenwich Mean Sidereal Time:
SiderealTime.init(julianDay: JulianDay.now)
Local Apparent Sidereal Time:
// Get location from GPS or hard code
let locTime = ObserverLocationTime(location: location, timestamp: JulianDay.now)
let localSidTime = SiderealTime.init(observerLocationTime: locTime)
More use cases can be found in the source and test cases.