/*******************************************************************************
*$ Component_name:
*	TKep_TrueAnom
*$ Abstract:
*	Test program for Kepler Library routines Kep_TrueAnom() and
*	Kep_MeanAnom().
*$ Keywords:
*	KEPLER, ORBITAL_MOTION
*	C, TEST_PROGRAM
*$ Declarations:
*	none
*$ Inputs:
*	none
*$ Outputs:
*	none
*$ Returns:
*	none
*$ Detailed_description:
*	This program tests Kepler Library routines Kep_TrueAnom() and
*	Kep_MeanAnom(), by confirming that they are proper inverse functions.
*
*	The user is repeatedly prompted for the eccentricity and mean anomaly.
*	The program types out the corresponding true anomaly, and then uses this
*	true anomaly to re-calculate the mean anomaly.
*$ External_references:
*	Kep_SetPlanet(), Kep_MeanAnom(), Kep_TrueAnom()
*$ Examples:
*	none
*$ Error_handling:
*	none
*$ Limitations:
*	none
*$ Author_and_institution:
*	Mark R. Showalter
*	NASA/Ames Research Center
*$ Version_and_date:
*	1991 June 18
*$ Change_history:
*	none
*******************************************************************************/
#include <stdio.h>
#include "kepler.h"
#include "pi.h"

main()
{
double	e, meanAnom, trueAnom;
int	status;

	while (1) {
		printf( "Enter e, meanAnom (deg): " );
		status = scanf( "%lf,%lf", &e, &meanAnom );
		if (status == EOF) break;

		meanAnom *= PI/180.;
	
		trueAnom = Kep_TrueAnom(e, meanAnom);
		printf( "True anomaly = % .15e\n", trueAnom * 180./PI);

		meanAnom = Kep_MeanAnom(e, trueAnom);
		printf( "Mean anomaly = % .15e\n", meanAnom * 180./PI);
	}

	printf( "\n" );
}

/******************************************************************************/
