ECE 2036 Project
Dependencies: mbed wave_player 4DGL-uLCD-SE
Diff: physics.cpp
- Revision:
- 0:cf4396614a79
- Child:
- 2:2042f29de6b7
diff -r 000000000000 -r cf4396614a79 physics.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/physics.cpp Fri Nov 03 18:48:48 2017 +0000 @@ -0,0 +1,18 @@ +#include "physics.h" +#include "math_extra.h" + +void forward_euler(Physics* state, float delta) +{ + // TODO: Implement proper forward euler updates for position and velocity + + // Compute random motion + float damp = 0.5; + float dx = damp*coin_flip(); + float dy = damp*coin_flip(); + + // Update position and velocity + state->px = state->px + dx; + state->py = state->py + dy; + state->vx = dx; + state->vy = dy; +} \ No newline at end of file