diff --git a/CMakeLists.txt b/CMakeLists.txt index e8d13ee..082953e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,9 +159,7 @@ set( SOURCES src/math/mathlib.cpp src/math/matrix.cpp src/math/plane.cpp - src/math/pluecker.cpp src/math/quaternion.cpp - src/math/random.cpp src/math/vector.cpp ) diff --git a/src/math/mathlib.h b/src/math/mathlib.h index 1bf040a..9edfceb 100644 --- a/src/math/mathlib.h +++ b/src/math/mathlib.h @@ -82,20 +82,6 @@ public: const Vec3 &pt1, const Vec3 &pt2, Vec3 *vec); }; -class kexRand -{ -public: - static void SetSeed(const int randSeed); - static int SysRand(); - static int Int(); - static int Max(const int max); - static float Float(); - static float CFloat(); - -private: - static int seed; -}; - class Quat { public: @@ -362,20 +348,6 @@ public: Vec4 vectors[4]; }; -class kexPluecker -{ -public: - kexPluecker(); - kexPluecker(const Vec3 &start, const Vec3 &end, bool bRay = false); - - void Clear(); - void SetLine(const Vec3 &start, const Vec3 &end); - void SetRay(const Vec3 &start, const Vec3 &dir); - float InnerProduct(const kexPluecker &pluecker) const; - - float p[6]; -}; - class Plane { public: diff --git a/src/math/pluecker.cpp b/src/math/pluecker.cpp deleted file mode 100644 index edd90de..0000000 --- a/src/math/pluecker.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//----------------------------------------------------------------------------- -// Note: this is a modified version of dlight. It is not the original software. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2013-2014 Samuel Villarreal -// svkaiser@gmail.com -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//----------------------------------------------------------------------------- -// -// DESCRIPTION: Pluecker operations -// This stuff makes my brain hurt... -// -//----------------------------------------------------------------------------- - -#include -#include "mathlib.h" - -// -// kexPluecker::kexPluecker -// - -kexPluecker::kexPluecker() -{ - Clear(); -} - -// -// kexPluecker::kexPluecker -// - -kexPluecker::kexPluecker(const Vec3 &start, const Vec3 &end, bool bRay) -{ - bRay ? SetRay(start, end) : SetLine(start, end); -} - -// -// kexPluecker::Clear -// - -void kexPluecker::Clear() -{ - p[0] = p[1] = p[2] = p[3] = p[4] = p[5] = 0; -} - -// -// kexPluecker::SetLine -// - -void kexPluecker::SetLine(const Vec3 &start, const Vec3 &end) -{ - p[0] = start.x * end.y - end.x * start.y; - p[1] = start.x * end.z - end.x * start.z; - p[3] = start.y * end.z - end.y * start.z; - - p[2] = start.x - end.x; - p[5] = end.y - start.y; - p[4] = start.z - end.z; -} - -// -// kexPluecker::SetRay -// - -void kexPluecker::SetRay(const Vec3 &start, const Vec3 &dir) -{ - p[0] = start.x * dir.y - dir.x * start.y; - p[1] = start.x * dir.z - dir.x * start.z; - p[3] = start.y * dir.z - dir.y * start.z; - - p[2] = -dir.x; - p[5] = dir.y; - p[4] = -dir.z; -} - -// -// kexPluecker::InnerProduct -// - -float kexPluecker::InnerProduct(const kexPluecker &pluecker) const -{ - return - p[0] * pluecker.p[4] + - p[1] * pluecker.p[5] + - p[2] * pluecker.p[3] + - p[4] * pluecker.p[0] + - p[5] * pluecker.p[1] + - p[3] * pluecker.p[2]; -} diff --git a/src/math/random.cpp b/src/math/random.cpp deleted file mode 100644 index 05b2fad..0000000 --- a/src/math/random.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//----------------------------------------------------------------------------- -// Note: this is a modified version of dlight. It is not the original software. -//----------------------------------------------------------------------------- -// -// Copyright (c) 2013-2014 Samuel Villarreal -// svkaiser@gmail.com -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//----------------------------------------------------------------------------- -// -// DESCRIPTION: Random operations -// -//----------------------------------------------------------------------------- - -#include -#include "mathlib.h" -#include - -#define RANDOM_MAX 0x7FFF - -int kexRand::seed = 0; - -// -// kexRand::SetSeed -// - -void kexRand::SetSeed(const int randSeed) -{ - seed = randSeed; -} - -// -// kexRand::SysRand -// - -int kexRand::SysRand() -{ - return rand(); -} - -// -// kexRand::Int -// - -int kexRand::Int() -{ - seed = 1479838765 - 1471521965 * seed; - return seed & RANDOM_MAX; -} - -// -// kexRand::Max -// - -int kexRand::Max(const int max) -{ - if (max == 0) - { - return 0; - } - - return Int() % max; -} - -// -// kexRand::Float -// - -float kexRand::Float() -{ - return (float)Max(RANDOM_MAX + 1) / ((float)RANDOM_MAX + 1); -} - -// -// kexRand::CFloat -// - -float kexRand::CFloat() -{ - return (float)(Max(20000) - 10000) * 0.0001f; -} -