MeeusJs
MeeusJs copied to clipboard
Azimuth errato
https://github.com/Fabiz/MeeusJs/blob/069bbe217e51a1973310cec7e532a197c934772f/lib/Astro.Coord.js#L315
Come da commento presente nel codice stesso, il valore di azimuth restituito è errato, in quanto calcolato rispetto al sud, mentre la convenzione lo vuole calcolato rispetto al nord; forse conviene aggiungere un'opzione per specificare quale convenzione usare.
io ho fatto così:
eqToHz: function(eqcoord, eclCoord, strad, typeOfAzimuth) { // ADDED OPTION FO FIX AZIMUTH
var H = strad - eclCoord.lng - eqcoord.ra; // ra = Right Ascension (alpha)
var sH = Math.sin(H); // H = hour angle
var cH = Math.cos(H);
var slat = Math.sin(eclCoord.lat); // lat = latitude (phi)
var clat = Math.cos(eclCoord.lat);
var sdec = Math.sin(eqcoord.dec); // dec = declination (delta)
var cdec = Math.cos(eqcoord.dec);
//// FIX AZIMUTH:
var addAz = 0;
if (typeof typeOfAzimuth !== 'undefined') {
if((typeOfAzimuth==="N")||(typeOfAzimuth==="n")) {
addAz=Math.PI;
} else {
addAz=0;
}
}
////
return new A.HzCoord(
// Meeus citation:
// "If one wishes to reckon the azimuth from the North instead of the South,
// add 180 degrees to the first value"
Math.atan2(sH, cH * slat - (sdec / cdec) * clat) + addAz, // Azimuth - (13.5) p. 93
Math.asin(slat * sdec + clat * cdec * cH) // Altitude - (13.6) p. 93
);
}