mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 23:36:43 +00:00
.. | ||
images | ||
.gitignore | ||
CannonBall.cpp | ||
makefile | ||
plot_trajectory.py | ||
README.md |
CannonBall
The CannonBall program is an example of using the SA::RK2Integrator to create a simple cannon ball simulation.
For each numerical integration time-step, the simulation program prints:
- time (s)
- 2D position vector (m)
- 2D velocity vector (m/s)
to stdout
, in Comma Separated Values (CSV) format.
Building & Running the Simulation Program
Generate the results as follows:
$ make
$ ./CannonBall > cannon.csv
Plotting the Results
The Python script, plot_trajectory.py
is provided to plot the results
in cannon.csv
using (Python) matplotlib.
Plot the cannon ball trajectory as follows:
$ python plot_trajectory.py