cosinekitty / astronomy

Astronomy Engine: multi-language calculation of Sun, Moon, and planet positions. Predicts lunar phases, eclipses, transits, oppositions, conjunctions, equinoxes, solstices, rise/set times, and other events. Provides vector and angular coordinate transforms among equatorial, ecliptic, horizontal, and galactic orientations.
MIT License
496 stars 63 forks source link

Zodiac Constellation #366

Open Zemelia opened 2 months ago

Zemelia commented 2 months ago

Hi, trying to get current Zodiac sign based on current moon phase. Using next lines:

const vec = GeoVector(Body.Moon, date, false);
const equ = EquatorFromVector(vec);
const constell = Constellation(equ.ra, equ.dec);

but together with standard 12 signs, also getting some like "Auriga". Also current zodiac's by date looks not accurate, maybe I'm using some wrong logic. Would be very thankful for any advice. Thanks! :)

cosinekitty commented 2 months ago

Hi @Zemelia! What you are seeing is due to the Moon sometimes moving significantly north or south of the ecliptic plane, away from where all the zodiac constellations are located.

Ancient astrologers tended to ignore ecliptic latitudes of the Moon and planets. They would focus on ecliptic longitudes, as if projecting their shadows onto a plane.

They would often divide the 360 degrees of longitude into 12 equal bands of 30 degrees, which differs from the modern (1875 and after) constellation boundaries defined by the IAU; these boundaries are of all different sizes and shapes, not at all equal.

You may have better luck calculating ecliptic coordinates instead of equatorial, and taking a look at the longitudes thus obtained.

Zemelia commented 2 months ago

Hi @cosinekitty , first of all thank you for your great and titan work on this library, it's awesome! And thanks for answer :) Acc. your answer, in context of ecliptic coordinates, so how could I use Constellation function as there I need ra and dec args?

Or just simply do like that?

  function getZodiacSign(lon: number) {
    const zodiacSigns = [
      'Aries',
      'Taurus',
      'Gemini',
      'Cancer',
      'Leo',
      'Virgo',
      'Libra',
      'Scorpio',
      'Sagittarius',
      'Capricorn',
      'Aquarius',
      'Pisces',
    ];

    const index = Math.floor(lon / 30);
    return zodiacSigns[index % 12];
  }
  const coords = EclipticGeoMoon(date);
  return getZodiacSign(coords.lon);

But it looks not so elegant, IMO :)

cosinekitty commented 2 months ago

Yes, your code example implements the idea I posed. Whether this idea is "correct" or useful is another matter; astrology isn't believable to me so I don't offer this as being "right" in any sense.