require 'spice_rub'
require 'gnuplotrb'
true
SpiceRub::KernelPool.instance.load_folder("spec/data/kernels")
9
moon = SpiceRub::Body.new(:moon)
moon_orbit = 86400 * 27
start = SpiceRub::Time.parse("22 Aug 2016")
#<SpiceRub::Time:0x000000035ab6c8 @et=525096068.182792>
times = SpiceRub::Time.time_series(start, start + moon_orbit, step: 3600)
distances = times.map { |t| moon.distance_from(earth, t) }
GnuplotRB::Plot.new(
[[times.map(&:et), distances], notitle: true] ,title: 'Distance of Moon from Earth v/s Time', with: 'lines')