Skip to content

Instantly share code, notes, and snippets.

@SIRHAMY
Created February 16, 2016 04:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SIRHAMY/4fef81b52f43cb277a6d to your computer and use it in GitHub Desktop.
Save SIRHAMY/4fef81b52f43cb277a6d to your computer and use it in GitHub Desktop.
Euler Midpoint Step Example
void Simulator::midpointStep(Eigen::Vector3d particle) {
Eigen::Vector3d halfTimeStepChangeV = { 0, (mTimeStep * 0.5) * -9.8, 0 };
particle.mVelocity[1] += halfTimeStepChangeV[1];
particle.mPosition[1] += (mTimeStep * particle.mVelocity[1]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment