Simulate realistic projectile motion!
Project description
ProjectilePy
A python library aimed at simulating and solving projectile motion problems. Includes various methods for running accurate numerical discrete-time simulations, both with and without drag.
Features:
- Configurable drag or drag-less simulations for projectiles.
- Real world atmospheric data for improved accuracy with Newtonian drag.
- Itterative root finding methods for calculating firing solutions to targets.
- Easy to use simulator object class, with included examples.
Installation:
You can install the package easily though pip by running the command pip install ProjectilePy
Usage:
There are usage eamples in the src/examples folder, I encourage you to look through them for specific use cases.
- Create a new intance of the simulator class passing the approapriate arguments to the constructor eg.
import projectilepy mySimulator = projectilepy.model(150,30)
- To run a straightforward simulation invoke the run() method on your simulator object.
mySimulator.run() mySimulator.run(override_angle=40, override_velocity=175) # Instance based overrides
- To examine the results, either invoke the analysis methods (such as final_position or time_of_flight), or directly access the positionValues list for the raw x-y coordiante pairs.
final_position = mySimulator.final_position() time_of_flight = mySimulator.time_of_flight() x, y = zip(*mySimulator.positionValues)
- If you have matplotlib installed, you can visualise the trajectory of your projectile using a plot.
fig, ax = plt.subplots() ax.plot(x, y) plt.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
projectilepy-0.1.1.tar.gz
(8.4 kB
view hashes)
Built Distribution
Close
Hashes for projectilepy-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80f4326e87771e08e923e025cd49243d0b52928aef1de0c81b94125b16183341 |
|
MD5 | d089eb01e4a9491b0bb75cb1a808bd9e |
|
BLAKE2b-256 | a4199d8ff4d0110800bbe8c9500ef9bc9a7930d744ee21ac42b99655baffedaa |