/[PAMELA software]/YodaProfiler/src/globals.cpp
ViewVC logotype

Contents of /YodaProfiler/src/globals.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Oct 20 11:39:40 2006 UTC (18 years, 1 month ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Create libsgp4.so shared lib; unified sgp4 code

1 //
2 // globals.cpp
3 //
4 #include "stdafx.h"
5 #include "globals.h"
6
7 //////////////////////////////////////////////////////////////////////////////
8 double sqr(const double x)
9 {
10 return (x * x);
11 }
12
13 //////////////////////////////////////////////////////////////////////////////
14 double Fmod2p(const double arg)
15 {
16 double modu = fmod(arg, TWOPI);
17
18 if (modu < 0.0)
19 modu += TWOPI;
20
21 return modu;
22 }
23
24 //////////////////////////////////////////////////////////////////////////////
25 // AcTan()
26 // ArcTangent of sin(x) / cos(x). The advantage of this function over arctan()
27 // is that it returns the correct quadrant of the angle.
28 double AcTan(const double sinx, const double cosx)
29 {
30 double ret;
31
32 if (cosx == 0.0)
33 {
34 if (sinx > 0.0)
35 ret = PI / 2.0;
36 else
37 ret = 3.0 * PI / 2.0;
38 }
39 else
40 {
41 if (cosx > 0.0)
42 ret = atan(sinx / cosx);
43 else
44 ret = PI + atan(sinx / cosx);
45 }
46
47 return ret;
48 }
49
50 //////////////////////////////////////////////////////////////////////////////
51 double rad2deg(const double r)
52 {
53 const double DEG_PER_RAD = 180.0 / PI;
54 return r * DEG_PER_RAD;
55 }
56
57 //////////////////////////////////////////////////////////////////////////////
58 double deg2rad(const double d)
59 {
60 const double RAD_PER_DEG = PI / 180.0;
61 return d * RAD_PER_DEG;
62 }
63

  ViewVC Help
Powered by ViewVC 1.1.23