My Project: openb3dlib.mod/openb3d/src/maths_helper.h Source File

My Project

maths_helper.h
Go to the documentation of this file.
1 #ifndef MATHS_HELPER_H
2 #define MATHS_HELPER_H
3 /*
4 * maths_helper.h
5 * iminib3d
6 *
7 * Created by Simon Harrison.
8 * Copyright Si Design. All rights reserved.
9 *
10 */
11
12 #include <cmath> // or <cmath> for C++
13
14 // Sombunall versions of math.h already define M_PI
15 #ifndef M_PI
16 // You can extend this approximation as far as you need to;
17 // this version was copied from the MINGW GCC headers
18 #define M_PI 3.14159265358979323846
19 #endif
20
21 #define DEG_CIRCLE 360
22 #define DEG_TO_RAD (M_PI / (DEG_CIRCLE / 2))
23 #define RAD_TO_DEG ((DEG_CIRCLE / 2) / M_PI)
24
25 // this assumes that your compiler supports C99 or C++
26 // otherwise, you can use macros to get the same result
27
28 inline double deg2rad(double degrees)
29 {
30 return degrees * DEG_TO_RAD;
31 }
32
33 inline double rad2deg(double radians)
34 {
35 return radians * RAD_TO_DEG;
36 }
37
38 double cosdeg(double);
39 double sindeg(double);
40 double tandeg(double);
41 double acosdeg(double);
42 double asindeg(double);
43 double atandeg(double);
44 double atan2deg(double,double);
45
46 #endif
DEG_TO_RAD
#define DEG_TO_RAD
Definition: maths_helper.h:22
asindeg
double asindeg(double)
Definition: maths_helper.cpp:32
sindeg
double sindeg(double)
Definition: maths_helper.cpp:17
rad2deg
double rad2deg(double radians)
Definition: maths_helper.h:33
atan2deg
double atan2deg(double, double)
Definition: maths_helper.cpp:42
atandeg
double atandeg(double)
Definition: maths_helper.cpp:37
acosdeg
double acosdeg(double)
Definition: maths_helper.cpp:27
cosdeg
double cosdeg(double)
Definition: maths_helper.cpp:12
RAD_TO_DEG
#define RAD_TO_DEG
Definition: maths_helper.h:23
deg2rad
double deg2rad(double degrees)
Definition: maths_helper.h:28
tandeg
double tandeg(double)
Definition: maths_helper.cpp:22