o-murphy / py-ballisticcalc

LGPL library for small arms ballistic calculations based on point-mass (3 DoF) plus spin drift.
https://pypi.org/project/py-ballisticcalc
GNU Lesser General Public License v3.0
20 stars 8 forks source link

Enforce sort order for winds #51

Closed dbookstaber closed 1 month ago

dbookstaber commented 6 months ago

In the case of multiple winds: TrajectoryCalc assumes that Shot.winds[] is sorted by Wind.until_distance (ascending). However right now we do not enforce that or even check whether that assumption is valid.

What is the best way to handle this?

o-murphy commented 6 months ago

Is this done?

dbookstaber commented 6 months ago

No

julius425 commented 4 months ago

Sorting can be done in Shot's __post_init__. Hey guys, im new to open source. Im not a math guy, but i like guns. Can i try to commit to your project?

dbookstaber commented 4 months ago

That would be great! The process to contribute:

  1. Fork the repository
  2. Make changes
  3. Ensure all unit tests pass
  4. Commit your changes to your fork
  5. Enter a "pull request" from your fork

Then the owner (@o-murphy) can review and accept your changes.

o-murphy commented 4 months ago

Sorting can be done in Shot's post_init. Hey guys, im new to open source. Im not a math guy, but i like guns. Can i try to commit to your project?

it shouldn't be difficult, I think it can be done in one line, but I would do it with some setter method, cause Shot dataclass ain't frozen and we have to sort winds each times it changes, not just on postinit