gwnavruntime/kernel/SF_Math.h Source File

SF_Math.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 /**************************************************************************
8 
9 PublicHeader: Kernel
10 Filename : KY_Math.h
11 Content : Math inline functions and macro definitions
12 Created : July 7, 2005
13 Authors : Michael Antonov, Maxim Shemanarev
14 
15 **************************************************************************/
16 
17 #ifndef INC_KY_Kernel_Math_H
18 #define INC_KY_Kernel_Math_H
19 
21 
22 #ifdef KY_MATH_H
23 #include KY_MATH_H
24 #elif defined(KY_OS_WINCE)
25 #include <cmath>
26 #elif defined(KY_CC_RENESAS)
27 #include <math.h>
28 #include <mathf.h>
29 #else
30 #include <math.h>
31 #include <stdlib.h>
32 #endif
33 
34 
35 // *** Useful math constants
36 
37 #define KY_MATH_EPSILON ((Kaim::Double)1.0e-12) // epsilon
38 #define KY_MATH_E ((Kaim::Double)2.7182818284590452354) // e
39 #define KY_MATH_LOG2E ((Kaim::Double)1.4426950408889634074) // log_2 e
40 #define KY_MATH_LOG10E ((Kaim::Double)0.43429448190325182765) // log_10 e
41 #define KY_MATH_LN2 ((Kaim::Double)0.69314718055994530942) // log_e 2
42 #define KY_MATH_LN10 ((Kaim::Double)2.30258509299404568402) // log_e 10
43 #define KY_MATH_PI ((Kaim::Double)3.14159265358979323846) // pi
44 #define KY_MATH_PI_2 ((Kaim::Double)1.57079632679489661923) // pi/2
45 #define KY_MATH_PI_3 ((Kaim::Double)1.04719755119659774615) // pi/3
46 #define KY_MATH_PI_4 ((Kaim::Double)0.78539816339744830962) // pi/4
47 #define KY_MATH_1_PI ((Kaim::Double)0.31830988618379067154) // 1/pi
48 #define KY_MATH_2_PI ((Kaim::Double)0.63661977236758134308) // 2/pi
49 #define KY_MATH_2_SQRTPI ((Kaim::Double)1.12837916709551257390) // 2/sqrt(pi)
50 #define KY_MATH_SQRT2 ((Kaim::Double)1.41421356237309504880) // sqrt(2)
51 #define KY_MATH_SQRT1_2 ((Kaim::Double)0.70710678118654752440) // 1/sqrt(2)
52 #define KY_MATH_DEGTORAD ((Kaim::Double)0.01745329251994329577) // pi/180
53 #define KY_MATH_TAN_PI_8 ((Kaim::Double)0.41421356237309504880) // tan(pi/8)
54 #define KY_MATH_SIN_PI_4 ((Kaim::Double)0.70710678118654752440) // sin(pi/4)
55 
56 // Degrees to Radians
57 #define KY_DEGTORAD(d) ((d)*(KY_MATH_PI)/((Kaim::Double)180.0))
58 #define KY_RADTODEG(r) ((r)*((Kaim::Double)180.0)/(KY_MATH_PI))
59 
60 #endif // INC_KY_Kernel_Math_H