ECE 2036 Project
Dependencies: mbed wave_player 4DGL-uLCD-SE
physics.cpp
- Committer:
- abraha2d
- Date:
- 2019-11-21
- Revision:
- 2:2042f29de6b7
- Parent:
- 0:cf4396614a79
File content as of revision 2:2042f29de6b7:
#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(); // state->px = state->px + dx; // state->py = state->py + dy; // state->vx = dx; // state->vy = dy; // Update position and velocity state->vx += state->ax * delta; state->vy += state->ay * delta; state->px += state->vx * delta; state->py += state->vy * delta; }