/*
 * Copyright 1990 by Baylor College of Medicine ALL RIGHTS RESERVED. 
 *
 * This program is subject to a license agreement between 
 * Baylor College of Medicine and MIT. Any use inconsistent with
 * said license and any use by persons other than the faculty, 
 * students and staff at MIT or any use on a computer not operated 
 * as part of the Athena Computing Environment (ACE) is expressly 
 * prohibited.
 */
#include "sincos.h"

get_sincos(a,s,c)
	double *s ;
	double *c ;
{
	/* Make sure angle is not way out of bounds */
	if (a >= 3600)
		a = a % 3600 ;
	else if (a < -3600)
		a = -((-a) % 3600) ;

	/* Make sure angle is not < 0 */
	if (a < 0)
		a += 3600 ;

	/* Now translate quadrants into first quad */
	switch(a / 900)
	{
		case 0 :
			*s = sin_cos[a] ;
			*c = sin_cos[900 - a] ;
			return ;
		case 1 :
			*s = sin_cos[1800 - a] ;
			*c = -sin_cos[a - 900] ;
			return ;
		case 2 :
			*s = -sin_cos[a - 1800] ;
			*c = -sin_cos[2700 - a] ;
			return ;
		default :
			*s = -sin_cos[3600 - a] ;
			*c = sin_cos[a - 2700] ;
			return ;
	}
}
