1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-28 21:49:27 +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) > MaxStep || abs(x_diff) > MaxStep) {
if(abs(y_diff) > abs(x_diff)) { 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); y_diff = std::clamp(y_diff, -MaxStep, MaxStep);
} else { } 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); x_diff = std::clamp(x_diff, -MaxStep, MaxStep);
} }
} }