Quincunx in the default aspects, sign-based moon phases, backend recalculate command
- AspectSet::Standard (default): the major aspects and the quincunx; forecasts use it too - Moon phase: new, quarter and full moon only within 12° and in the matching signs - backend recalculate: recalculates stored charts, comparisons and forecasts, then queues every analysis again (nobody is charged) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -168,7 +168,9 @@ Use the usual Hungarian astrological terms:
|
||||
- signs: Kos, Bika, Ikrek, Rák, Oroszlán, Szűz, Mérleg, Skorpió, Nyilas, Bak, Vízöntő, Halak (\"a Nap a Rák jegyében\", \"Kos Aszcendens\");
|
||||
- planets and points: Nap, Hold, Merkúr, Vénusz, Mars, Jupiter, Szaturnusz, Uránusz, Neptunusz, Plútó, Chiron (Kiron), \
|
||||
Észak-Holdcsomópont, Dél-Holdcsomópont, Lilith (Fekete Hold), Aszcendens, Descendens, Medium Coeli (MC), Imum Coeli (IC), Szerencsepont;
|
||||
- aspects: együttállás (konjunkció), szextil, kvadrát (négyzet), trigon, szembenállás (oppozíció);
|
||||
- aspects: együttállás (konjunkció), szextil, kvadrát (négyzet), trigon, kvinkunx (150°), szembenállás (oppozíció);
|
||||
- Moon phases: újhold, növő sarló, első negyed, növő (domború) hold, telihold, fogyó (domború) hold, utolsó negyed, \
|
||||
fogyó sarló; name the phase given in the data, never another one;
|
||||
- elements and modalities: tűz, föld, levegő, víz (\"tűz elem\", \"a föld hiánya\"); kardinális, fix, változó;
|
||||
Never leave English words (e.g. fire, earth, air, water) in the Hungarian text.
|
||||
- other: \"a 3. házban\", \"a horoszkóp uralkodója\", retrográd, uralom (domicilium), száműzetés, exaltáció, esés, nappali/éjszakai horoszkóp.";
|
||||
|
||||
@@ -616,7 +616,7 @@ pub fn calculate_chart(engine: &dyn Ephemeris, input: &ChartInput) -> Result<Nat
|
||||
let elongation = normalize(moon - sun);
|
||||
let moon_phase = MoonPhase {
|
||||
elongation,
|
||||
phase: phase_name(elongation),
|
||||
phase: phase_name(sun, moon),
|
||||
illumination: engine.illumination(Body::Moon, jd)?,
|
||||
waxing: elongation < 180.0,
|
||||
};
|
||||
@@ -720,10 +720,28 @@ fn above_horizon(lon: f64, ascendant: f64) -> bool {
|
||||
angle::arc(ascendant, lon) >= 180.0
|
||||
}
|
||||
|
||||
pub(crate) fn phase_name(elongation: f64) -> MoonPhaseName {
|
||||
/// At most this far from the exact new moon, quarter or full moon is the
|
||||
/// Moon still in that phase, as astrologers read it.
|
||||
const LUNATION_ORB: f64 = 12.0;
|
||||
|
||||
/// The Moon's phase from the longitudes of the Sun and the Moon. A main phase
|
||||
/// (new, first quarter, full, last quarter) is the exact aspect of the lights
|
||||
/// within [`LUNATION_ORB`] and in the matching signs: a full moon only between
|
||||
/// opposite signs (Aries–Libra, Taurus–Scorpio, ...), a new moon in one sign.
|
||||
/// Otherwise the Moon is crescent or gibbous, so a Moon 150° from the Sun (a
|
||||
/// quincunx) or 30° past the opposition is not full.
|
||||
pub(crate) fn phase_name(sun: f64, moon: f64) -> MoonPhaseName {
|
||||
use MoonPhaseName::*;
|
||||
[NewMoon, WaxingCrescent, FirstQuarter, WaxingGibbous, FullMoon, WaningGibbous, LastQuarter, WaningCrescent]
|
||||
[((elongation / 45.0).floor() as usize).min(7)]
|
||||
let elongation = (moon - sun).rem_euclid(360.0);
|
||||
let signs_apart = (ZodiacSign::from_longitude(moon).index() + 12 - ZodiacSign::from_longitude(sun).index()) % 12;
|
||||
let main = [NewMoon, FirstQuarter, FullMoon, LastQuarter];
|
||||
for (k, phase) in main.into_iter().enumerate() {
|
||||
let off = (elongation - 90.0 * k as f64 + 180.0).rem_euclid(360.0) - 180.0;
|
||||
if off.abs() <= LUNATION_ORB && signs_apart == 3 * k {
|
||||
return phase;
|
||||
}
|
||||
}
|
||||
[WaxingCrescent, WaxingGibbous, WaningGibbous, WaningCrescent][((elongation / 90.0) as usize).min(3)]
|
||||
}
|
||||
|
||||
/// Points taking part in aspects as `(id, longitude, speed)`: everything but
|
||||
@@ -744,8 +762,10 @@ pub(crate) fn aspect_points(points: &[Point], angles: Option<&Angles>) -> Vec<(P
|
||||
|
||||
pub(crate) fn aspect_kinds(set: AspectSet) -> Vec<AspectKind> {
|
||||
let mut kinds = AspectKind::MAJOR.to_vec();
|
||||
if set == AspectSet::Extended {
|
||||
kinds.extend(AspectKind::MINOR);
|
||||
match set {
|
||||
AspectSet::Major => {}
|
||||
AspectSet::Standard => kinds.push(AspectKind::Quincunx),
|
||||
AspectSet::Extended => kinds.extend(AspectKind::MINOR),
|
||||
}
|
||||
kinds
|
||||
}
|
||||
@@ -888,9 +908,31 @@ mod tests {
|
||||
// Ascendant at 0° Aries: Cancer (90°) is below (IC side), Capricorn (270°) above.
|
||||
assert!(!above_horizon(90.0, 0.0));
|
||||
assert!(above_horizon(270.0, 0.0));
|
||||
assert_eq!(phase_name(0.0), MoonPhaseName::NewMoon);
|
||||
assert_eq!(phase_name(185.0), MoonPhaseName::FullMoon);
|
||||
assert_eq!(phase_name(359.9), MoonPhaseName::WaningCrescent);
|
||||
use MoonPhaseName::*;
|
||||
// (Sun, Moon) longitudes
|
||||
assert_eq!(phase_name(10.0, 10.0), NewMoon);
|
||||
assert_eq!(phase_name(15.0, 5.0), NewMoon); // 10° before, both in Aries
|
||||
assert_eq!(phase_name(3.0, 355.0), WaningCrescent); // 8° before, but Pisces–Aries
|
||||
assert_eq!(phase_name(28.0, 359.0), WaningCrescent); // 29° before, and in Pisces
|
||||
assert_eq!(phase_name(10.0, 195.0), FullMoon); // Aries–Libra, 5° past
|
||||
assert_eq!(phase_name(2.0, 170.0), WaxingGibbous); // 12° before, but Aries–Virgo
|
||||
assert_eq!(phase_name(25.0, 199.0), FullMoon); // 6° before, Aries–Libra
|
||||
assert_eq!(phase_name(10.0, 203.0), WaningGibbous); // 13° past: beyond the orb
|
||||
// a quincunx between the lights is not a full moon
|
||||
assert_eq!(phase_name(10.0, 159.0), WaxingGibbous);
|
||||
assert_eq!(phase_name(10.0, 221.1), WaningGibbous);
|
||||
assert_eq!(phase_name(10.0, 100.0), FirstQuarter); // Aries–Cancer
|
||||
assert_eq!(phase_name(10.0, 285.0), LastQuarter); // Aries–Capricorn
|
||||
assert_eq!(phase_name(10.0, 340.0), WaningCrescent);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_default_aspects_include_the_quincunx() {
|
||||
let pts = [(PointId::Sun, 10.0, 1.0), (PointId::Moon, 159.0, 13.0)]; // 149° apart
|
||||
assert_eq!(AspectSet::default(), AspectSet::Standard);
|
||||
let found = find_aspects(&pts, AspectSet::Standard, 1.0);
|
||||
assert_eq!(found.iter().map(|a| a.aspect).collect::<Vec<_>>(), [AspectKind::Quincunx]);
|
||||
assert!(find_aspects(&pts, AspectSet::Major, 1.0).is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -37,8 +37,15 @@ const NEAR_DAYS: f64 = 200.0;
|
||||
|
||||
const TRANSITING: [Body; 5] = [Body::Jupiter, Body::Saturn, Body::Uranus, Body::Neptune, Body::Pluto];
|
||||
const PROGRESSED: [Body; 5] = [Body::Sun, Body::Moon, Body::Mercury, Body::Venus, Body::Mars];
|
||||
const ASPECTS: [AspectKind; 5] =
|
||||
[AspectKind::Conjunction, AspectKind::Sextile, AspectKind::Square, AspectKind::Trine, AspectKind::Opposition];
|
||||
/// The aspects of the default chart (`AspectSet::Standard`): the major ones and the quincunx.
|
||||
const ASPECTS: [AspectKind; 6] = [
|
||||
AspectKind::Conjunction,
|
||||
AspectKind::Sextile,
|
||||
AspectKind::Square,
|
||||
AspectKind::Trine,
|
||||
AspectKind::Quincunx,
|
||||
AspectKind::Opposition,
|
||||
];
|
||||
|
||||
type Result<T> = std::result::Result<T, EngineError>;
|
||||
|
||||
@@ -409,7 +416,7 @@ impl Year<'_> {
|
||||
|
||||
// The progressed lunation phase: the progressed Moon's distance from the progressed Sun.
|
||||
let (sun, moon) = (&samples[0], &samples[1]);
|
||||
let phase_at = |i: usize| phase_name((moon.lon[i] - sun.lon[i]).rem_euclid(360.0));
|
||||
let phase_at = |i: usize| phase_name(sun.lon[i], moon.lon[i]);
|
||||
let lunar_phase = phase_at(0);
|
||||
let lunar_phase_change = if known {
|
||||
(1..moon.lon.len())
|
||||
|
||||
@@ -96,8 +96,10 @@ pub enum Ayanamsa {
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum AspectSet {
|
||||
/// Conjunction, sextile, square, trine, opposition.
|
||||
#[default]
|
||||
Major,
|
||||
/// The major aspects plus the quincunx (150°), which most astrologers read.
|
||||
#[default]
|
||||
Standard,
|
||||
/// Major aspects plus semisextile, semisquare, quintile, sesquiquadrate, biquintile, quincunx.
|
||||
Extended,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user