diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-04 16:39:46 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-04 16:39:46 +0200 |
commit | d25cae9b614dd8fe6f7506daa5afca96e9fc9838 (patch) | |
tree | 153ee890d30931b547201c41eec43baaab88c576 /include/godot_cpp/core/math.hpp | |
parent | 047b08922d1d9b9fbbb1c7ba8c1a2a1369b24d55 (diff) | |
parent | e83d472c002f5be617e87d37987f5bae4a355c07 (diff) | |
download | redot-cpp-d25cae9b614dd8fe6f7506daa5afca96e9fc9838.tar.gz |
Merge pull request #859 from aaronfranke/basis-transform-quat
Update Basis/Transform3D/Quaternion to match the engine
Diffstat (limited to 'include/godot_cpp/core/math.hpp')
-rw-r--r-- | include/godot_cpp/core/math.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/godot_cpp/core/math.hpp b/include/godot_cpp/core/math.hpp index 6bc2344..78f90ca 100644 --- a/include/godot_cpp/core/math.hpp +++ b/include/godot_cpp/core/math.hpp @@ -537,6 +537,27 @@ inline bool is_zero_approx(double s) { return abs(s) < CMP_EPSILON; } +inline float absf(float g) { + union { + float f; + uint32_t i; + } u; + + u.f = g; + u.i &= 2147483647u; + return u.f; +} + +inline double absd(double g) { + union { + double d; + uint64_t i; + } u; + u.d = g; + u.i &= (uint64_t)9223372036854775807ull; + return u.d; +} + inline double smoothstep(double p_from, double p_to, double p_weight) { if (is_equal_approx(static_cast<real_t>(p_from), static_cast<real_t>(p_to))) { return p_from; |