Skip to content

Instantly share code, notes, and snippets.

@cstein
Created May 3, 2012 15:42
Show Gist options
  • Save cstein/2586660 to your computer and use it in GitHub Desktop.
Save cstein/2586660 to your computer and use it in GitHub Desktop.
keeping particles inside the box
if abs(X[i] + dt*dX[i])>1:
dX[i] = -dX[i]
if abs(Y[i] + dt*dY[i])>1:
dY[i] = -dY[i]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment