diff options
-rw-r--r-- | logic/pipeline.cpp | 3 | ||||
-rw-r--r-- | proto-libevdev/ftnoir_protocol_libevdev.cpp | 2 | ||||
-rw-r--r-- | tracker-tobii/ftnoir_tracker_tobii.cpp | 12 |
3 files changed, 8 insertions, 9 deletions
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 171c7016..074cce24 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -605,8 +605,7 @@ void pipeline::run() backlog_time = {}; } - const int sleep_ms = (int)clamp(interval - backlog_time, - ms{0}, ms{10}).count(); + const int sleep_ms = (int)std::clamp(interval - backlog_time, ms{0}, ms{10}).count(); #ifdef DEBUG_TIMINGS debug_timings(backlog_time.count(), sleep_ms); diff --git a/proto-libevdev/ftnoir_protocol_libevdev.cpp b/proto-libevdev/ftnoir_protocol_libevdev.cpp index 5b07beff..d357670d 100644 --- a/proto-libevdev/ftnoir_protocol_libevdev.cpp +++ b/proto-libevdev/ftnoir_protocol_libevdev.cpp @@ -120,7 +120,7 @@ void evdev::pose(const double* headpose, const double*) { for (int i = 0; i < 6; i++) { int value = (int)(headpose[i] * mid_input / max_value[i] + mid_input); - int normalized = clamp(value, min_input, max_input); + int normalized = std::clamp(value, min_input, max_input); (void) libevdev_uinput_write_event(uidev, EV_ABS, axes[i], normalized); } diff --git a/tracker-tobii/ftnoir_tracker_tobii.cpp b/tracker-tobii/ftnoir_tracker_tobii.cpp index 43cb1662..595cf410 100644 --- a/tracker-tobii/ftnoir_tracker_tobii.cpp +++ b/tracker-tobii/ftnoir_tracker_tobii.cpp @@ -23,9 +23,9 @@ void tobii::data(double *data) else { center_pose = p; } - data[0] = clamp(p.position_xyz[0] * 30.0 / 300.0, -30.0, 30.0); - data[1] = clamp(p.position_xyz[1] * 30.0 / 300.0, -30.0, 30.0); - data[2] = clamp(p.position_xyz[2] * 30.0 / 300.0, -30.0, 30.0); + data[0] = std::clamp(p.position_xyz[0] * 30.0 / 300.0, -30.0, 30.0); + data[1] = std::clamp(p.position_xyz[1] * 30.0 / 300.0, -30.0, 30.0); + data[2] = std::clamp(p.position_xyz[2] * 30.0 / 300.0, -30.0, 30.0); } double max_yaw = 90.0; @@ -33,7 +33,7 @@ void tobii::data(double *data) if (center_pose.rotation_validity_xyz[1] == TOBII_VALIDITY_VALID) { p.rotation_xyz[1] = p.rotation_xyz[1] - center_pose.rotation_xyz[1]; } - data[3] = clamp(p.rotation_xyz[1] * 100.0 * max_yaw / 90.0, -max_yaw, max_yaw); + data[3] = std::clamp(p.rotation_xyz[1] * 100.0 * max_yaw / 90.0, -max_yaw, max_yaw); } double max_pitch = 90.0; @@ -41,7 +41,7 @@ void tobii::data(double *data) if (center_pose.rotation_validity_xyz[0] == TOBII_VALIDITY_VALID) { p.rotation_xyz[0] = p.rotation_xyz[0] - center_pose.rotation_xyz[0]; } - data[4] = clamp(p.rotation_xyz[0] * 100.0 * max_pitch / 90.0, -max_pitch, max_pitch); + data[4] = std::clamp(p.rotation_xyz[0] * 100.0 * max_pitch / 90.0, -max_pitch, max_pitch); } double max_roll = 90.0; @@ -49,7 +49,7 @@ void tobii::data(double *data) if (center_pose.rotation_validity_xyz[2] == TOBII_VALIDITY_VALID) { p.rotation_xyz[2] = p.rotation_xyz[2] - center_pose.rotation_xyz[2]; } - data[5] = clamp(p.rotation_xyz[2] * 100.0 * max_roll / 90.0, -max_roll, max_roll); + data[5] = std::clamp(p.rotation_xyz[2] * 100.0 * max_roll / 90.0, -max_roll, max_roll); } } } |