Vedākṣha

Integration Guide

Planetary Positions

Compute ecliptic longitude, latitude, heliocentric distance, and daily motion for any of the 10 major bodies at any moment in time. Accuracy is sub-arcsecond, verified against NASA JPL Horizons.

Output Fields

.longitudef64

Ecliptic longitude in degrees, 0–360. Sun at 0° is 0° Aries in the tropical frame.

.latitudef64

Ecliptic latitude in degrees. Positive = north of the ecliptic plane. Near zero for most planets.

.distancef64

Geocentric distance in Astronomical Units (AU). 1 AU ≈ 149,597,870 km.

.speedf64

Daily motion in degrees per day. Negative values indicate retrograde motion.

.retrogradebool

Derived convenience flag. True when speed is negative — no separate lookup needed.

.bodyBody

Typed enum: Sun, Moon, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto.

Coordinate Pipeline

Raw planetary positions from the JPL DE440 ephemeris are delivered in the International Celestial Reference System (ICRS), a barycentric inertial frame. Vedākṣha applies a four-step pipeline to produce the geocentric ecliptic coordinates your chart expects.

1

ICRS → Geocentric

Subtract the Earth–Moon barycenter offset. Light-travel time correction (aberration) applied here.

2

Aberration

Annual aberration shifts apparent position by up to ~20 arcseconds. Uses the IAU 2006 stellar aberration model.

3

Precession & Nutation

IAU 2006 precession and IAU 2000B nutation rotate the frame from mean ICRS to the true equatorial frame of date.

4

Equatorial → Ecliptic

Final rotation by the true obliquity of the ecliptic yields the ecliptic longitude and latitude you receive.

Computing a Single Position

Construct an EphemerisProvider once and call it repeatedly. The provider caches internal state so repeated calls in a loop are cheap.

positions.rs
use vedaksha::prelude::*;

fn main() -> Result<(), VedakshaError> {
    let eph = EphemerisProvider::new()?;

    // Julian Day for 20 March 2024, 12:00 UT
    let jd = calendar_to_jd(2024, 3, 20, 12.0);

    let pos = eph.compute(Body::Moon, jd)?;

    println!("Longitude : {:.6}°", pos.longitude);
    println!("Latitude  : {:.6}°", pos.latitude);
    println!("Distance  : {:.6} AU", pos.distance);
    println!("Speed     : {:.4}°/day", pos.speed);
    println!("Retrograde: {}", pos.retrograde);

    Ok(())
}

All 10 Major Bodies at Once

compute_all runs a single internal time setup and computes every body in one pass. Faster than calling compute ten times individually.

all_bodies.rs
let positions = eph.compute_all(jd)?;

for pos in &positions {
    let retro = if pos.retrograde { " (R)" } else { "" };
    println!(
        "{:<10} {:>10.4}°{}",
        pos.body.name(), pos.longitude, retro
    );
}

// Sun           29.9841°
// Moon         159.3012°
// Mercury       11.7234° (R)
// Venus         23.4401°
// Mars         286.1047°
// Jupiter       15.8892°
// Saturn       348.7113°
// Uranus        51.9234°
// Neptune      357.0981°
// Pluto        301.7654°

Retrograde Detection

Retrograde motion is detected directly from the sign of the daily speed value. When a planet appears to move backward against the stars from Earth's perspective, its longitudinal speed becomes negative. No separate lookup table or configuration is required — the retrograde field is derived automatically.

Note on Stationary Points

At the exact moment a planet transitions from direct to retrograde (or vice versa), its speed passes through zero. Vedākṣha reports the raw computed speed with full precision, so you can detect near-stationary planets by checking for speeds smaller than a threshold of your choosing (e.g., |speed| < 0.01°/day).

Accuracy

Ephemeris

JPL DE440

Covers 9999 BCE – 9999 CE with sub-arcsecond precision for inner planets.

Verification

JPL Horizons

Position residuals < 1 arcsecond against published Horizons data for 2000–2050.

Obliquity

IAU 2006

Mean obliquity computed from the 5th-order polynomial recommended by IAU 2006 resolution B1.