MathUtils.h

Go to the documentation of this file.
00001 
00002 
00008 /*
00009 */
00011 
00012 #ifndef __SSF_MATH_UTILS_H__
00013 #define __SSF_MATH_UTILS_H__
00014 #include <math.h>
00015 namespace O_SESSAME {
00017 
00021 
00022 
00033 typedef double Angle;
00034 
00042 inline double DMS2Deg(const double& _Degrees, const double& _Minutes, const double& _Seconds)
00043 {
00044     return _Degrees + _Minutes / 60 + _Seconds / 3600;
00045 }
00046 
00054 inline void Deg2DMS(const double& _Angle, double& Degrees, double& Minutes, double& Seconds)
00055 {
00056     Degrees = floor(_Angle);
00057     Minutes = floor((_Angle - Degrees) * 60);
00058     Seconds = (_Angle - Degrees - Minutes / 60) * 3600;
00059 }
00060 
00067 inline Angle DMS2Rad(const double& _Degrees,const double& _Minutes, const double& _Seconds)
00068 {
00069     return DMS2Deg(_Degrees, _Minutes, _Seconds) * M_PI / 180;
00070 }
00071 
00076 inline Angle Deg2Rad(const Angle& _Degrees)
00077 {
00078     return _Degrees * M_PI / 180;
00079 }
00080 
00087 inline void Rad2DMS(const Angle& _Radians, double& Degrees, double& Minutes, double& Seconds)
00088 {
00089     double Angle = _Radians * 180 / M_PI;
00090     Deg2DMS(Angle, Degrees, Minutes, Seconds);
00091     return;
00092 }
00093 
00098 inline Angle Rad2Deg(const Angle& _Radians)
00099 {
00100     return _Radians * 180 / M_PI;
00101 }
00106 inline Angle atanh(const double& _z)
00107 {
00108     return 0.5 * log((1+_z)/(1-_z));
00109 } // end of Trigonometry
00111 
00112 
00113 } // close namespace O_SESSAME
00114 
00115 #endif 
00116 
00117 // Do not change the comments below - they will be added automatically by CVS
00118 /*****************************************************************************
00119 *       $Log: MathUtils.h,v $
00120 *       Revision 1.2  2003/05/22 03:00:07  nilspace
00121 *       Updated Angle type and inline'd all functions.
00122 *       
00123 *       Revision 1.1  2003/05/15 18:32:20  nilspace
00124 *       Initial submission.
00125 *       
00126 *
00127 ******************************************************************************/

Generated on Wed Aug 6 12:58:47 2003 for Open-Sessame Framework by doxygen1.3