Skip to content

Commit

Permalink
Fixed wrong conversion
Browse files Browse the repository at this point in the history
Signed-off-by: Cédric Foellmi <[email protected]>
  • Loading branch information
onekiloparsec committed Jun 7, 2024
1 parent c1caa24 commit a5acae9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/coordinates/horizontal2equatorial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { DEG2RAD, H2DEG, RAD2DEG } from '@/constants'
* @returns {Degree}
*/
export function getRightAscensionFromHorizontal (jd: JulianDay, horCoords: HorizontalCoordinates, geoCoords: GeographicCoordinates): Degree {
const lmst = getLocalSiderealTime(jd, geoCoords.longitude) * H2DEG
const lmst: Degree = getLocalSiderealTime(jd, geoCoords.longitude) * H2DEG
const rHorCoords = {
azimuth: horCoords.azimuth * DEG2RAD,
altitude: horCoords.altitude * DEG2RAD
Expand All @@ -25,9 +25,9 @@ export function getRightAscensionFromHorizontal (jd: JulianDay, horCoords: Horiz
const x = Math.cos(rHorCoords.azimuth) * Math.sin(rGeoCoords.latitude)
+ Math.tan(rHorCoords.altitude) * Math.cos(rGeoCoords.latitude)

const value = lmst - Math.atan2(y, x)
const value: Degree = lmst - Math.atan2(y, x) * RAD2DEG

return fmod360(value * RAD2DEG)
return fmod360(value)
}

/**
Expand Down

0 comments on commit a5acae9

Please sign in to comment.