require 'spice_rub'
require 'gnuplotrb'
true
SpiceRub::KernelPool.instance.load_folder("spec/data/kernels")
9
earth = SpiceRub::Body.new(:earth)
revolution = 365 * 86400
start = SpiceRub::Time.parse("22 Aug 2016")
#<SpiceRub::Time:0x00000003930ff0 @et=525096068.182792>
times = SpiceRub::Time.time_series(start, start + revolution, step: 86400)
positions = times.map { |t| earth.position_at(t) }
x_coord = positions.map {|p| p[0]}
y_coord = positions.map {|p| p[1]}
z_coord = positions.map {|p| p[2]}
g = GnuplotRB::Splot.new(
[[x_coord, y_coord, z_coord]], title: "XYZ Plot of Revolution of The Earth from the Sun", with: :lines)