dbookstaber / py_ballistics

Point-mass ballistic trajectory calculator with support for custom drag models
GNU Lesser General Public License v3.0
2 stars 0 forks source link

Time-step implementation of calculator #2

Closed dbookstaber closed 6 months ago

dbookstaber commented 1 year ago

Current version of trajectory calculator takes time steps that are a function of velocity.x – typically the calc_step is 0.5ft, and:

delta_time = calc_step / velocity_vector.x

I.e., we change the time step so that each step advances 0.5ft along the x-axis. This will degrade accuracy when bullet is following high angles. Instead we should determine the time step by bullet speed – i.e., velocity_vector.magnitude() – so that resolution does not depend on trajectory.

dbookstaber commented 7 months ago

Implemented in https://github.com/dbookstaber/py_ballistics/commit/41025d0c2b6dcc8208916743c5eeec5f3f9e742e

Also fixed: get_calc_step() was weird, taking the range distance step and applying a confusing function that would produce smaller calculation step sizes when running large TrajectoryData steps. Before the step size could go from as high as 0.5ft down to 0.1ft unexpectedly. Now it just ensures that we're running 0.25ft steps (half the Settings._MAX_CALC_STEP_SIZE) unless a smaller value is explicitly requested.

dbookstaber commented 7 months ago

Not quite there; changing to delta_time = calc_step / velocity needs some other changes to work; had to roll back for now.