WIP math reimplementations

This commit is contained in:
2015-10-11 17:33:42 -07:00
parent 57cfbc93b9
commit 5e2b997266
6 changed files with 80 additions and 24 deletions

View File

@@ -1,4 +1,5 @@
#include <iostream>
#include <iomanip>
#include <MathLib.hpp>
// This is only for testing, do NOT do this normally
@@ -15,13 +16,14 @@ int main()
assert(!vec.normalized().canBeNormalized());
float blarg = 5.f;
CVector3f t{100, 100, 200};
Math::clamp(blarg, 0.f, 1.f);
blarg = Math::clamp(0.f, blarg, 1.f);
CAABox test{{-100, -100, -100}, {100, 100, 100}};
CAABox test2{{-100, -100, -100}, {100, 100, 100}};
CAABox test3{{-50, -50, -50}, {50, 50, 50}};
CAABox test4{{-50, -50, -105}, {50, 50, 105}};
CVector3f point(-90, 67, -105);
CVector3f closestPoint = test.closestPointAlongVector(point);
CVector3d doubleVec(100, -100, -200);
assert(t.isEqu(t));
assert(test.inside(test));
@@ -29,7 +31,8 @@ int main()
assert(test3.inside(test));
assert(!test4.inside(test));
std::cout << Math::round(1.5) << std::endl;
std::cout << std::setprecision(16) << (double)Math::fastArcCosR(1.802073) << std::endl;
std::cout << Math::floorPowerOfTwo(256) << std::endl;
return 0;
}