diff options
author | chai <chaifix@163.com> | 2019-01-12 21:48:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-12 21:48:33 +0800 |
commit | 8b00d67febf133e89f6a0bfabc41feed555dc4a9 (patch) | |
tree | fe48ef17c250afa40c2588300fcdb5920dba6951 /src/libjin/math/je_ranged_value.cpp | |
parent | a907c39756ef6b368d06643afa491c49a9044a8e (diff) |
*去掉文件前缀je_
Diffstat (limited to 'src/libjin/math/je_ranged_value.cpp')
-rw-r--r-- | src/libjin/math/je_ranged_value.cpp | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/src/libjin/math/je_ranged_value.cpp b/src/libjin/math/je_ranged_value.cpp deleted file mode 100644 index b28e72b..0000000 --- a/src/libjin/math/je_ranged_value.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "je_ranged_value.h" - -namespace JinEngine -{ - namespace Math - { - - RangedValue::RangedValue() - : mCount(0) - { - } - - RangedValue::RangedValue(float* points, uint n) - : mCount(n) - { - for (uint i = 0; i < n; ++i) - { - float x = points[2*i]; - float y = points[2*i + 1]; - mXAxis.push_back(x); - mYAxis.push_back(y); - } - } - - void RangedValue::addPoint(float x, float y) - { - mXAxis.push_back(x); - mYAxis.push_back(y); - ++mCount; - } - - void RangedValue::removePoint(uint i) - { - mXAxis.erase(mXAxis.begin() + i); - mYAxis.erase(mYAxis.begin() + i); - --mCount; - } - - void RangedValue::insertPoint(uint i, float x, float y) - { - mXAxis.insert(mXAxis.begin() + i, x); - mYAxis.insert(mYAxis.begin() + i, y); - ++mCount; - } - - float RangedValue::getValue(float x) - { - int endIndex = -1; - int n = mCount; - for (int i = 1; i < n; i++) { - float t = mXAxis[i]; - if (t > x) { - endIndex = i; - break; - } - } - if (endIndex == -1) return mYAxis[n - 1]; - int startIndex = endIndex - 1; - float startValue = mYAxis[startIndex]; - float startX = mXAxis[startIndex]; - return startValue + (mYAxis[endIndex] - startValue) * ((x - startX) / (mXAxis[endIndex] - startX)); - } - - void RangedValue::clear() - { - mXAxis.clear(); - mYAxis.clear(); - } - - } -}
\ No newline at end of file |