move: add move_next()

Computes the next state of a MoveParams given position, and returns it
as new MoveParams.
This commit is contained in:
Andrei Alexeyev 2023-02-15 22:45:26 +01:00
parent 7d57eb0937
commit 9502941631
No known key found for this signature in database
GPG key ID: 72D26128040B9690

View file

@ -23,6 +23,11 @@ typedef struct MoveParams {
cmplx move_update(cmplx *restrict pos, MoveParams *restrict params);
cmplx move_update_multiple(uint times, cmplx *restrict pos, MoveParams *restrict params);
INLINE MoveParams move_next(cmplx pos, MoveParams move) {
move_update(&pos, &move);
return move;
}
INLINE MoveParams move_linear(cmplx vel) {
return (MoveParams) { vel, 0, 1 };
}