summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJacob Palecki <[email protected]>2021-04-09 16:27:32 -0700
committerJacob Palecki <[email protected]>2021-04-09 16:27:32 -0700
commit060b79bda0b656bd9aec253389706681a565443e (patch)
tree93c7246b34873dc694b064f7b8b2a2bf560a9ea8 /common
parentFixed some bugs (diff)
downloadrawaccel-060b79bda0b656bd9aec253389706681a565443e.tar.xz
rawaccel-060b79bda0b656bd9aec253389706681a565443e.zip
Some more small additions and fixes
Diffstat (limited to 'common')
-rw-r--r--common/accel-lookup.hpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/common/accel-lookup.hpp b/common/accel-lookup.hpp
index c014b84..97af0ff 100644
--- a/common/accel-lookup.hpp
+++ b/common/accel-lookup.hpp
@@ -167,6 +167,7 @@ namespace rawaccel {
fp_rep_range range;
;
arbitrary_lut_point data[capacity] = {};
+ float raw_data_in[capacity*2] = {};
int log_lookup[capacity] = {};
double first_point_speed;
double last_point_speed;
@@ -248,10 +249,10 @@ namespace rawaccel {
last_arbitrary_index = length - 2;
last_point_speed = points[last_arbitrary_index].x;
- int start = static_cast<int>(floor(log(first_point_speed) / log(2.0)));
- first_log_lookup_speed = pow(2.0, start);
- int end = static_cast<int>(floor(log(last_point_speed) / log(2.0)));
- last_log_lookup_speed = pow(2.0, end);
+ int start = static_cast<int>(floor(log(first_point_speed)));
+ first_log_lookup_speed = exp(start*1.0);
+ int end = static_cast<int>(floor(log(last_point_speed)));
+ last_log_lookup_speed = exp(end*1.0);
int num = static_cast<int>(capacity / (end - start));
range = fp_rep_range{ start, end, num };
last_log_lookup_index = num * (end - start) - 1;
@@ -266,6 +267,8 @@ namespace rawaccel {
for (int i = 0; i < length; i++)
{
next = points[i];
+ raw_data_in[i * 2] = next.x;
+ raw_data_in[i * 2 + 1] = next.y;
double slope = (next.y - current.y) / (next.x - current.x);
double intercept = next.y - slope * next.x;
si_pair current_si = {
@@ -284,8 +287,10 @@ namespace rawaccel {
this->log_lookup[log_index] = i;
log_index++;
log_inner_iterator += log_inner_slice;
- log_value = pow(2, log_inner_iterator);
+ log_value = exp(log_inner_iterator);
}
+
+ current = next;
}
}