1 /** 2 * @file lv_vg_lite_math.h 3 * 4 */ 5 6 #ifndef LV_VG_LITE_MATH_H 7 #define LV_VG_LITE_MATH_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "../../lv_conf_internal.h" 18 19 #if LV_USE_DRAW_VG_LITE 20 21 #include <math.h> 22 #include <stdbool.h> 23 #include <float.h> 24 25 /********************* 26 * DEFINES 27 *********************/ 28 29 #define MATH_PI 3.14159265358979323846f 30 #define MATH_HALF_PI 1.57079632679489661923f 31 #define MATH_TWO_PI 6.28318530717958647692f 32 #define DEG_TO_RAD 0.017453292519943295769236907684886f 33 #define RAD_TO_DEG 57.295779513082320876798154814105f 34 35 #define MATH_TANF(x) tanf(x) 36 #define MATH_SINF(x) sinf(x) 37 #define MATH_COSF(x) cosf(x) 38 #define MATH_ASINF(x) asinf(x) 39 #define MATH_ACOSF(x) acosf(x) 40 #define MATH_FABSF(x) fabsf(x) 41 #define MATH_SQRTF(x) sqrtf(x) 42 43 #define MATH_RADIANS(deg) ((deg) * DEG_TO_RAD) 44 #define MATH_DEGREES(rad) ((rad) * RAD_TO_DEG) 45 46 /********************** 47 * TYPEDEFS 48 **********************/ 49 50 /********************** 51 * GLOBAL PROTOTYPES 52 **********************/ 53 math_zero(float a)54static inline bool math_zero(float a) 55 { 56 return (MATH_FABSF(a) < FLT_EPSILON); 57 } 58 math_equal(float a,float b)59static inline bool math_equal(float a, float b) 60 { 61 return math_zero(a - b); 62 } 63 64 float math_fast_inv_sqrtf(float number); 65 66 /********************** 67 * MACROS 68 **********************/ 69 70 #endif /*LV_USE_DRAW_VG_LITE*/ 71 72 #ifdef __cplusplus 73 } /*extern "C"*/ 74 #endif 75 76 #endif /*LV_VG_LITE_MATH_H*/ 77