LayOut C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
math_helpers.h
Go to the documentation of this file.
1 // Copyright 2015 Trimble Inc. All rights reserved.
2 
7 #ifndef SKETCHUP_UTILS_MATH_HELPERS_H_
8 #define SKETCHUP_UTILS_MATH_HELPERS_H_
9 
10 #include <SketchUpAPI/common.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
22 SU_EXPORT double SUDegreesToRadians(double value);
23 
30 SU_EXPORT double SURadiansToDegrees(double value);
31 
39 SU_EXPORT bool SUEquals(double val1, double val2);
40 
48 SU_EXPORT bool SULessThan(double val1, double val2);
49 
58 SU_EXPORT bool SULessThanOrEqual(double val1, double val2);
59 
67 SU_EXPORT bool SUGreaterThan(double val1, double val2);
68 
77 SU_EXPORT bool SUGreaterThanOrEqual(double val1, double val2);
78 
79 // SketchUp 2017 added these functions, but lacked the SU* prefix. As of
80 // SketchUp 2018 they were renamed. This compatibility macro is left around
81 // until SketchUp 2019. Enable to temporarily re-enable the old function names.
82 #ifdef SU_COMPAT_MATH_UTILS
83 
85 static double DegreesToRadians(double value) {
86  return SUDegreesToRadians(value);
87 }
88 
90 static bool Equals(double val1, double val2) {
91  return SUEquals(val1, val2);
92 }
93 
95 static bool GreaterThan(double val1, double val2) {
96  return SUGreaterThan(val1, val2);
97 }
98 
100 static bool GreaterThanOrEqual(double val1, double val2) {
101  return SUGreaterThanOrEqual(val1, val2);
102 }
103 
105 static bool LessThan(double val1, double val2) {
106  return SULessThan(val1, val2);
107 }
108 
110 static bool LessThanOrEqual(double val1, double val2) {
111  return SULessThanOrEqual(val1, val2);
112 }
113 
115 static double RadiansToDegrees(double value) {
116  return SURadiansToDegrees(value);
117 }
118 #endif
119 
120 #ifdef __cplusplus
121 } // end extern "C"
122 #endif // __cplusplus
123 
124 #endif // SKETCHUP_UTILS_MATH_HELPERS_H_