public static PreciseVector getPlanetVelocity(string abb, float JDE, float deltaT) { PreciseVector l0 = getPlanetPosition(abb, JDE); PreciseVector dl = getPlanetPosition(abb, JDE + deltaT); return((dl - l0) * (58.14f / deltaT)); //convert from au/days - 58.1 because wolfram said so (1 / (earth average velocity in au/day)) }
public static double angle(PreciseVector a, PreciseVector b) { double cos = scalar(a, b) / (length(a) * length(b)); return(Math.Acos(cos)); }
public static double distance(PreciseVector a, PreciseVector b) { return(Math.Sqrt(Math.Pow(a.x - b.x, 2) + Math.Pow(a.y - b.y, 2))); }
public static double length(PreciseVector v) { return(Math.Sqrt(Math.Pow(v.x, 2) + Math.Pow(v.y, 2))); }
public static double scalar(PreciseVector a, PreciseVector b) { return(a.x * b.x + a.y * b.y); }