if ( abs(velocity.x) > abs(velocity.y) ) {
x = round(position.x);
y = round(position.y + (x - position.x) * velocity.y / velocity.x);
} else {
y = round(position.y);
x = round(position.x + (y - position.y) * velocity.x / velocity.y);
}[/code:1yfaqumf]
In an interpolation expression.