1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Attempt to improve trajectory.

This commit is contained in:
Thomas Harte 2024-05-13 22:26:36 -04:00
parent 308b3ca448
commit 1d8b33d7ae

View File

@ -322,10 +322,10 @@ class ConcreteMachine:
if(abs(y_diff) > MaxStep || abs(x_diff) > MaxStep) {
if(abs(y_diff) > abs(x_diff)) {
x_diff = (x_diff * MaxStep + abs(y_diff) - 1) / abs(y_diff);
x_diff = (x_diff * MaxStep + (abs(y_diff) >> 1)) / abs(y_diff);
y_diff = std::clamp(y_diff, -MaxStep, MaxStep);
} else {
y_diff = (y_diff * MaxStep + abs(x_diff) - 1) / abs(x_diff);
y_diff = (y_diff * MaxStep + (abs(x_diff) >> 1)) / abs(x_diff);
x_diff = std::clamp(x_diff, -MaxStep, MaxStep);
}
}