From a2bfa8c621aef418df2096f7979bf72f5083d88c Mon Sep 17 00:00:00 2001 From: Jon Stevens Date: Wed, 19 Jun 2024 00:14:45 -0700 Subject: [PATCH] remove need for CF_NO_DEFAULT_MATH_FUNCTIONS --- include/cute_math.h | 57 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/include/cute_math.h b/include/cute_math.h index 7f85c1d3d..bdb9d2921 100644 --- a/include/cute_math.h +++ b/include/cute_math.h @@ -10,18 +10,49 @@ #include "cute_defines.h" -#ifndef CF_NO_DEFAULT_MATH_FUNCTIONS -#include -#define CF_SQRTF sqrtf -#define CF_FABSF fabsf -#define CF_FABS fabs -#define CF_SINF sinf -#define CF_COSF cosf -#define CF_ACOSF acosf -#define CF_ATAN2F atan2f -#define CF_FLOORF floorf -#define CF_ROUNDF roundf -#define CF_FMODF fmodf +#ifndef CF_SQRTF + #include + #define CF_SQRTF sqrtf +#endif + +#ifndef CF_FABSF + #include + #define CF_FABSF fabsf +#endif + +#ifndef CF_SINF + #include + #define CF_SINF sinf +#endif + +#ifndef CF_COSF + #include + #define CF_COSF cosf +#endif + +#ifndef CF_ACOSF + #include + #define CF_ACOSF acosf +#endif + +#ifndef CF_ATAN2F + #include + #define CF_ATAN2F atan2f +#endif + +#ifndef CF_FLOORF + #include + #define CF_FLOORF floorf +#endif + +#ifndef CF_ROUNDF + #include + #define CF_ROUNDF roundf +#endif + +#ifndef CF_FMODF + #include + #define CF_FMODF fmodf #endif //-------------------------------------------------------------------------------------------------- @@ -1472,7 +1503,7 @@ CF_INLINE bool cf_parallel(CF_V2 a, CF_V2 b, float tol) { float k = cf_len(a) / cf_len(b); b = cf_mul_v2_f(b, k); - if (CF_FABS(a.x - b.x) < tol && CF_FABS(a.y - b.y) < tol) { + if (CF_FABSF(a.x - b.x) < tol && CF_FABSF(a.y - b.y) < tol) { return true; } else { return false;