position function
Rectangular coordinates referenced to the mean equinox of date.
Uses low-accuracy solar position. For high accuracy, use VSOP87 (to be added with planetposition module).
Implementation
({double x, double y, double z}) position(double jde) {
final t = j2000Century(jde);
final sun = solar.trueSun(t);
final r = solar.radius(t);
final eps = nut.meanObliquity(jde);
final sS = math.sin(sun.lon);
final cS = math.cos(sun.lon);
final sEps = math.sin(eps);
final cEps = math.cos(eps);
return (
x: r * cS,
y: r * (sS * cEps),
z: r * (sS * sEps),
);
}