MathUtil: C++20/23 modernisations

I've also created DegreesToRadians/RadiansToDegrees utility functions since there was a lot of repeated code
This commit is contained in:
Joshua Vandaële
2026-06-28 08:33:40 +02:00
parent 774200dcf4
commit 6dcb0817a2
23 changed files with 136 additions and 68 deletions

View File

@@ -538,7 +538,7 @@ bool evdevDevice::AddNode(std::string devnode, int fd, libevdev* dev)
// evdev resolution is specified in "g"s and deg/s.
// Convert these to m/s/s and rad/s.
constexpr ControlState accel_scale = MathUtil::GRAVITY_ACCELERATION;
constexpr ControlState gyro_scale = MathUtil::TAU / 360;
constexpr ControlState gyro_scale = MathUtil::DegreesToRadians(ControlState{1});
add_motion_inputs(ABS_X, accel_scale);
add_motion_inputs(ABS_RX, gyro_scale);