This suprisingly took even more effort than the ButtonRing and I got a lot more help from BingChat this time around. Essentially, I wanted to replace the simple method with one that waited until it was sure both the real and imaginary components were accounted for. This is the plan I wrote just to have an idea on what to do:
I then asked BingChat many C++ questions, such as
I then started deriving equations in Desmos:
To get that slow movement zone, I needed to store the fractional part of the number I sent to SendMouse so that it could be carried forward.
Eventually, I had to create a massive wall of logs to debug:
I still had the issue with overshooting, so I had the idea to implement a bell curve that would multiply the output by considering the %-changed of the magnitude. Didn't help:
I went in, fixed a bug with the %-change calculation, and tried many different curves, namely those that actually went negative when the %-change was close to -100% as it would actually cause the mouse to bounce back slightly, mirroring the actual feeling on the spacemouse.
The finishing touch I've just added now are some lines so that the bounceback feature actually bounces back in the same direction it came in:
Before this change, I'd often have situations like this:
[9 Dec] I've mostly been using the below displacement multiplier curves (before admitting defeat and trying a Logitech G300s mouse):
For the multiplier when decelerating (-1 <= x <= 0), I just tried the 4 combinations of the 2 curves and got the most points in the accuracy test with the above configuration.
For accelerating, my reasoning was that I'd either be coasting (so near 0) or wanting to accelerate (usually over 14), thus values in the middle should be supressed as I'm probably just transitioning from one to the other. In practice, looking at the logs, it seems that change-in-magnitude readings are something like 20 -> 8 -> 2 -> 1.5 -> 0.8 -> 0.2..., so don't seem to be many values around in the suppression region anyway.
If I could just get the ergonomics of the SpaceExplorer with the speed and precision of the G300s, that would be great. Like the opposite version of the Wing mouse: