This function writes in sequential mode a type 12 segment (discrete states of the positions and velocities, Hermite interpolation with equal timesteps) to the SPK file associated to the ephemeris descriptor eph.

The states array must be of size record_count*6 and have the following structure :

X coord 1st record

Y coord 1st record

Z coord 1st record

dX 1st record

dY 1st record

dZ 1st record

...

...

...

...

...

...

X coord (record_count)th record

Y coord (record_count)th record

Z coord (record_count)th record

dX (record_count)th record

dY (record_count)th record

dZ (record_count)th record

The following example creates a new ephemeris file ephemeris.bsp with segment of type 12 for the heliocentric coordinates of Venus.

t_writephbin *weph;
const char segid[] = "seg_planet";

weph = writeph_spk_create("ephemeris.bsp","planet_2", 0);
if (weph)
{
      int len_timespan = 32; /* days */
      int frame = 1; /* ICRF */
      int record_count = 100;
      int interpolation_degree = 7;
      double jd_start = 2460000;
      double jd_end = jd_start+record_count*len_timespan;
      double pos_vel[600];  /*  size = 100*6  = record_count* 6 components */

      for (int k=0; k<record_count; k++)
      {

           double jd = jd_start+k*len_timespan;

           /* ... fill the array pos_vel with the positions and velocities at the date jd ...
                pos_vel[..] =...
           */
      }
      writeph_spk12_seq_write(weph, NAIFID_VENUS, NAIFID_SUN, frame, jd_start, 0.0, jd_end, 0.0,
                             len_timespan, pos_vel, record_count, interpolation_degree, segid);


      writeph_close(weph);
}