mirror of
https://github.com/thunderbrewhq/typhoon.git
synced 2025-12-12 02:22:30 +00:00
feat(math): add CMath
This commit is contained in:
parent
62d5c2d355
commit
9bebffa8a1
3 changed files with 94 additions and 0 deletions
6
tempest/Math.hpp
Normal file
6
tempest/Math.hpp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef TEMPEST_MATH_HPP
|
||||
#define TEMPEST_MATH_HPP
|
||||
|
||||
#include "tempest/math/CMath.hpp"
|
||||
|
||||
#endif
|
||||
30
tempest/math/CMath.hpp
Normal file
30
tempest/math/CMath.hpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef TEMPEST_MATH_C_MATH_HPP
|
||||
#define TEMPEST_MATH_C_MATH_HPP
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <storm/Error.hpp>
|
||||
|
||||
class CMath {
|
||||
public:
|
||||
// Static variables
|
||||
static constexpr float PI = 3.1415927f;
|
||||
static constexpr float TWO_PI = 6.2831855f;
|
||||
static constexpr float OO_TWO_PI = 1.0f / TWO_PI;
|
||||
|
||||
// Static functions
|
||||
static uint32_t fuint(float n) {
|
||||
return static_cast<uint32_t>(n);
|
||||
}
|
||||
|
||||
static uint32_t fuint_n(float n) {
|
||||
return static_cast<uint32_t>(n + 0.5f);
|
||||
}
|
||||
|
||||
static float sqrt(float x) {
|
||||
STORM_ASSERT(x >= 0.0f);
|
||||
return ::sqrt(x);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue