/*========================= MiscSphericalCoord.m ============================*/
/* MiscSphericalCoord class contains and supports values representing locations
   in a Spherical coordinate system. Angles are stored internally as radians
   at all times, but may be stored or retrieved as degrees.

   DMA Release 0.8, Copyright @1993 by Genesis Project, Ltd. All Rights
   Reserved. For further information on terms and conditions see:
		Documentation/GISKit/Agreements-Legal-README

HISTORY
25-Feb-93  Dale Amon at GPL
	   Created.
*/

#import <MiscFoundation/MiscSphericalCoord.h>

@implementation MiscSphericalCoord

/*===========================================================================*/
/* Coordinate handling methods */
/*===========================================================================*/
/* set Spherical Coord value from degrees */

-setCoordPhiDegrees: (double) phi
       thetaDegrees: (double) theta
		rho: (double) rho
 {	[self  setCoord: [MiscCoord degreesToRadians: phi]
		       : [MiscCoord degreesToRadians: theta]
		       : rho];
	return self;
 }


/*---------------------------------------------------------------------------*/
/* Set Spherical Coord value from radians */

-setCoordPhiRadians: (double) phi
       thetaRadians: (double) theta
		rho: (double) rho
 {	[self setCoord: phi : theta : rho];
	return self;
 }


/*---------------------------------------------------------------------------*/
/* Get Spherical Coord value in radians */

-coordPhiDegrees: (double *) phi
    thetaDegrees: (double *) theta
	     rho: (double *) rho
 {	[self coord: phi : theta : rho];

	*phi   = [MiscCoord degreesToRadians: *phi];
	*theta = [MiscCoord degreesToRadians: *theta];
	return self;
 }


/*---------------------------------------------------------------------------*/
/* Get Spherical Coord value in radians */

-coordPhiRadians: (double *) phi
    thetaRadians: (double *) theta
	     rho: (double *) rho
 {	[self coord: phi : theta : rho];
	return self;
 }

/*---------------------------------------------------------------------------*/
/* spherical coordinates are: phi,theta and rho */

-(double) phiRadians	{return [MiscCoord radiansToDegrees: [self coord1]];}
-(double) phiDegrees	{return [self coord1];}
-(double) thetaRadians	{return [MiscCoord radiansToDegrees: [self coord2]];}
-(double) thetaDegrees	{return [self coord2];}
-(double) rho		{return [self coord3];}

@end
