tmp
This commit is contained in:
parent
65cb26a627
commit
1ead32d84a
71 changed files with 199 additions and 282 deletions
|
|
@ -5,11 +5,10 @@ file(GLOB SOURCES "./private/*.cpp")
|
|||
file(GLOB HEADERS "./public/*.hpp")
|
||||
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS})
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ./public/)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Allocators)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Containers)
|
||||
|
||||
### -------------------------- Tests -------------------------- ###
|
||||
enable_testing()
|
||||
file(GLOB TEST_SOURCES "./tests/*.cpp")
|
||||
add_executable(${PROJECT_NAME}Tests ${TEST_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME}Tests ${PROJECT_NAME} UnitTest++)
|
||||
add_test(NAME ${PROJECT_NAME}Tests COMMAND ${PROJECT_NAME}Tests)
|
||||
add_executable(Test${PROJECT_NAME} ${TEST_SOURCES})
|
||||
target_link_libraries(Test${PROJECT_NAME} ${PROJECT_NAME} UnitTest++)
|
||||
add_test(NAME Test${PROJECT_NAME} COMMAND Test${PROJECT_NAME})
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
|
||||
/// whoaoao wtf
|
||||
|
||||
#include "MathCommon.hpp"
|
||||
#include "Allocators.hpp"
|
||||
|
||||
static tp::ModuleManifest* sModuleDependencies[] = { &tp::gModuleAllocators, nullptr };
|
||||
|
||||
tp::ModuleManifest tp::gModuleMath = ModuleManifest("Math", nullptr, nullptr, sModuleDependencies);
|
||||
|
||||
tp::alnf std_sin(tp::alnf radians);
|
||||
tp::alnf std_tan(tp::alnf radians);
|
||||
tp::alnf std_cos(tp::alnf radians);
|
||||
tp::alnf std_acos(tp::alnf val);
|
||||
tp::alnf std_sqrt(tp::alnf val);
|
||||
tp::alnf std_rad(tp::alnf val);
|
||||
tp::alnf std_deg(tp::alnf val);
|
||||
tp::alnf std_atan2(tp::alnf X, tp::alnf Y);
|
||||
tp::alnf std_atan(tp::alnf val);
|
||||
tp::alnf std_log2(tp::alnf val);
|
||||
|
||||
tp::alnf tp::sin(const tp::alnf radians) { return std_sin((halnf) radians); }
|
||||
tp::alnf tp::tan(const tp::alnf radians) { return std_tan((halnf) radians); }
|
||||
tp::alnf tp::cos(const tp::alnf radians) { return std_cos((halnf) radians); }
|
||||
tp::alnf tp::acos(const tp::alnf val) { return std_acos((halnf) val); }
|
||||
tp::alnf tp::sqrt(const tp::alnf val) { return std_sqrt((halnf) val); }
|
||||
tp::alnf tp::rad(const tp::alnf val) { return val * (PI / 180.f); }
|
||||
tp::alnf tp::deg(const tp::alnf val) { return val * (180.f / PI); }
|
||||
tp::alnf tp::atan2(const tp::alnf X, const tp::alnf Y) { return std_atan2((halnf) X, (halnf) Y); }
|
||||
tp::alnf tp::atan(const tp::alnf val) { return std_atan((halnf) val); }
|
||||
tp::alnf tp::log2(alnf val) { return std_log2(val); }
|
||||
|
||||
#include <cmath>
|
||||
|
||||
tp::alnf std_sin(const tp::alnf radians) { return sinf((tp::halnf) radians); }
|
||||
tp::alnf std_tan(const tp::alnf radians) { return tanf((tp::halnf) radians); }
|
||||
tp::alnf std_cos(const tp::alnf radians) { return cosf((tp::halnf) radians); }
|
||||
tp::alnf std_acos(const tp::alnf val) { return acos((tp::halnf) val); }
|
||||
tp::alnf std_sqrt(const tp::alnf val) { return sqrt((tp::halnf) val); }
|
||||
tp::alnf std_rad(const tp::alnf val) { return val * (PI / 180.f); }
|
||||
tp::alnf std_deg(const tp::alnf val) { return val * (180.f / PI); }
|
||||
tp::alnf std_atan2(const tp::alnf X, const tp::alnf Y) { return atan2((tp::halnf) X, (tp::halnf) Y); }
|
||||
tp::alnf std_atan(const tp::alnf val) { return atan((tp::halnf) val); }
|
||||
tp::alnf std_log2(const tp::alnf val) { return log2((tp::halnf) val); }
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
#include "Topology.hpp"
|
||||
|
||||
#include "NewPlacement.hpp"
|
||||
|
||||
using namespace tp;
|
||||
|
||||
Vec3F TrigCache::gHitPos;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
using namespace tp;
|
||||
|
||||
Trig::Trig() {
|
||||
MODULE_SANITY_CHECK(gModuleMath)
|
||||
p1.assign(0.f, 0.f, 0.f);
|
||||
p2.assign(0.f, 0.f, 0.f);
|
||||
p3.assign(0.f, 0.f, 0.f);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace tp {
|
|||
|
||||
[[nodiscard]] ComplexCart operator-(const ComplexCart& in) const { return { in.r - r, in.i - i }; }
|
||||
|
||||
[[nodiscard]] Number mod() const { return tp::sqrt(i * i + r * r); }
|
||||
[[nodiscard]] Number mod() const { return sqrt(i * i + r * r); }
|
||||
|
||||
[[nodiscard]] Number arg() const { return atan2(r, i); }
|
||||
|
||||
|
|
|
|||
|
|
@ -13,17 +13,7 @@
|
|||
#define SQRT2 1.4142135623730950488016887242
|
||||
#define EXP 2.7182818284590452353602874714
|
||||
|
||||
namespace tp {
|
||||
extern ModuleManifest gModuleMath;
|
||||
#include <cmath>
|
||||
|
||||
alnf sin(alnf radians);
|
||||
alnf tan(alnf radians);
|
||||
alnf atan2(alnf X, alnf Y);
|
||||
alnf atan(alnf val);
|
||||
alnf cos(alnf radians);
|
||||
alnf acos(alnf val);
|
||||
alnf sqrt(alnf val);
|
||||
alnf rad(alnf val);
|
||||
alnf deg(alnf val);
|
||||
alnf log2(alnf val);
|
||||
}
|
||||
#define RAD(val) (val * (PI / 180.f))
|
||||
#define DEG(val) (val * (180.f / PI))
|
||||
|
|
@ -16,7 +16,7 @@ namespace tp {
|
|||
inline Type& set(ualni i, TypeArg arg) { return mBuff[i] = arg; }
|
||||
|
||||
public:
|
||||
Vec() { MODULE_SANITY_CHECK(gModuleMath) }
|
||||
Vec() = default;
|
||||
|
||||
explicit Vec(TypeArg val) { assign(val); }
|
||||
|
||||
|
|
|
|||
|
|
@ -44,16 +44,5 @@ SUITE(Math) {
|
|||
}
|
||||
|
||||
int main() {
|
||||
tp::ModuleManifest* deps[] = { &tp::gModuleMath, &tp::gModuleUtils, nullptr };
|
||||
tp::ModuleManifest testModule("MathTest", nullptr, nullptr, deps);
|
||||
|
||||
if (!testModule.initialize()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool res = UnitTest::RunAllTests();
|
||||
|
||||
testModule.deinitialize();
|
||||
|
||||
return res;
|
||||
return UnitTest::RunAllTests();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue