/*  
 *  - - - - - - - - - - - 
 *   g a l _ p v t 2 p v  
 *  - - - - - - - - - - - 
 *  
 *  This routine is part of the General Astrodynamics Library  
 *
 *  Description:
 *
 *     This routine calculates position and velocity from starting position and 
 *     velocity at given time using Universal variables. This routine is valid
 *     for all orbit types.
 *  
 *  Status: 
 *  
 *     Classical Model.  
 *  
 *  Given:  
 *
 *     gm               d           Gravitational coefficient
 *     pv0            d[2][3]       Epoch Position & Velocity Vectors (m, m/s)
 *     ed0, ed1         d           Epoch date (TT)
 *     tt0, tt1         d           Required date (TT)              
 *  
 *  Returned:  
 *  
 *     pv             d[2][3]       Position & velocity vectors for required date (m, m/s )
 * 
 *  Notes:  
 *  
 *  1) The TT dates are Julian Dates, apportioned in any  
 *     convenient way between the two arguments.  For example,  
 *     JD(TT)=2450123.7 could be expressed in any of these ways,  
 *     among others:  
 *  
 *               ed0          ed1  
 *  
 *         2450123.7          0.0        (JD method)  
 *         2451545.0      -1421.3        (J2000 method)  
 *         2400000.5      50123.2        (MJD method)  
 *         2450123.5          0.2        (date & time method)  
 *  
 *     The JD method is the most natural and convenient to use in  
 *     cases where the loss of several decimal digits of resolution  
 *     is acceptable.  The J2000 method is best matched to the way  
 *     the argument is handled internally and will deliver the  
 *     optimum resolution.  The MJD method and the date & time methods  
 *     are both good compromises between resolution and convenience.  
 *
 *  2) The iteration method is the Laguerre's method described in Chobotov page 58.
 *     It was selected as it converged faster than the Newton-Raphson method 
 *     described by Vallado, and the choice of initial value is simpler.
 *
 *  3) The calculations of sn and cn are from Vallado as they are simpler
 *      to implement.
 *
 *  Called:
 *
 *     gal_pm             Modulus of p-vector
 *     gal_pdp            p-vector dot product
 *     gal_sxp            product of p-vector and scalar
 *     gal_ppp            p-vector addition
 *
 *
 *  References:
 *
 *     Orbital Mechanics Third Edition
 *     AiAA Education Series
 *     Chobotov, Vladimir A. Ed.
 *     Pages 55-61
 *
 *     Fundamentals of Astrodynamics and Applications
 *     Vallado, David A. Second Edition 2004
 *     Pages 101-103
 *
 *  This revision:  
 * 
 *     2008 September 13
 *  
 *  Copyright (C) 2008 Paul C. L. Willmott. See notes at end. 
 *  
 *-----------------------------------------------------------------------  
 */  

#ifndef _GAL_PVT2PV_H_  
#define _GAL_PVT2PV_H_ 1  
  
#undef  __BEGIN_DECLS  
#undef  __END_DECLS  
#ifdef  __cplusplus  
#define __BEGIN_DECLS extern "C" {  
#define __END_DECLS }  
#else  
#define __BEGIN_DECLS /* empty */  
#define __END_DECLS   /* empty */  
#endif
  
__BEGIN_DECLS  

void
gal_pvt2pv
  (
    double gm,
    double pv0[2][3],
    double ed0,
    double ed1, 
    double tt0,
    double tt1,
    double pv[2][3]
  ) ;
 
__END_DECLS  
  
#endif /* !_GAL_PVT2PV_H_ */ 

/*
 *  gal - General Astrodynamics Library  
 *  Copyright (C) 2008 Paul C. L. Willmott  
 *  
 *  This program is free software; you can redistribute it and/or modify  
 *  it under the terms of the GNU General Public License as published by  
 *  the Free Software Foundation; either version 2 of the License, or  
 *  (at your option) any later version.  
 *  
 *  This program is distributed in the hope that it will be useful,  
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of  
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 *  GNU General Public License for more details.  
 *  
 *  You should have received a copy of the GNU General Public License along  
 *  with this program; if not, write to the Free Software Foundation, Inc.,  
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  
 *    
 *  Contact:  
 *    
 *  Paul Willmott  
 *  vp9mu@amsat.org  
 */  
  
