ballistics-engine 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ec34ab4bdd56332259b3194f81201b960cfb222524599d5fea2dfd3e625696f
4
- data.tar.gz: 162e799cd63a05c3dbb482867dcf189b39cb9cac4adc176422f7738ae3160c8c
3
+ metadata.gz: f01d0ad0ea0ef3b70c1d6ff2eb9a19b11604c9d849ed460a108b62dd03a42168
4
+ data.tar.gz: 8addfb5018331b89eda7704cc3aada03a0ca983eec6d7803f3238c2e00f15c2b
5
5
  SHA512:
6
- metadata.gz: bfd13d22a449ca9190e0d661a0e4fd8c151e28bee2135d44ff648ba0717e7676ff21807b448d787205b64de295ca23d8b9ece5b847c2a611021bc366661e1729
7
- data.tar.gz: aebf742f19ba2e1134dfd9e755d2ef21cf6c5724a82398898a425792f5b1ddee9f69ec3b35509685c3b74f816fe212594fec72b7e06a86337aa66d41185c2a48
6
+ metadata.gz: 93c76bd2f98e287d9fcd150de8b186b76be6294a554bc5a7aa1618d36fff2756ba3a0e51faf64d5b9075ba2c0492244724bae424c48bb3626486c0c363b5da7a
7
+ data.tar.gz: 1a8859fce7dbc03735932c68e827cb65eb5de44de8eda91a2f432b53f1e7a634dfef2dc5e01a88255cf40c3cdd56728d2ffafe47a7eb33922dd00744f4e71140
data/Cargo.lock CHANGED
@@ -93,9 +93,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
93
93
 
94
94
  [[package]]
95
95
  name = "ballistics-engine"
96
- version = "0.22.11"
96
+ version = "0.24.0"
97
97
  source = "registry+https://github.com/rust-lang/crates.io-index"
98
- checksum = "76e5814dcee860b6d400ef5bd432833afad4750328ab3666befe73fa2fe0eae4"
98
+ checksum = "1dfd09f132c3fbe4f35fea3ed8cf86eddfcf863428b39a984d9f5998470506ec"
99
99
  dependencies = [
100
100
  "clap",
101
101
  "clap_complete",
data/Cargo.toml CHANGED
@@ -15,7 +15,7 @@ name = "ballistics_engine_rb"
15
15
  crate-type = ["cdylib"]
16
16
 
17
17
  [dependencies]
18
- ballistics-engine = { version = "0.23.0", default-features = false }
18
+ ballistics-engine = { version = "0.24.0", default-features = false }
19
19
  magnus = "0.8"
20
20
 
21
21
  [profile.release]
@@ -4,7 +4,7 @@ require "ballistics_engine_rb"
4
4
 
5
5
  # Top-level module for the BallisticsEngine gem
6
6
  module BallisticsEngine
7
- VERSION = "0.23.0"
7
+ VERSION = "0.24.0"
8
8
 
9
9
  class Error < StandardError; end
10
10
  end
data/src/lib.rs CHANGED
@@ -3,6 +3,7 @@ use ballistics_engine::{
3
3
  AtmosphericConditions, BCSegmentData, BallisticInputs, DragModel, MonteCarloParams,
4
4
  TrajectorySolver, WindConditions, calculate_zero_angle_with_conditions, run_monte_carlo,
5
5
  };
6
+ use ballistics_engine::wind::WindSegment;
6
7
 
7
8
  // Unit conversion constants
8
9
  const GRAINS_TO_KG: f64 = 0.00006479891;
@@ -49,12 +50,12 @@ fn build_wind(h: &RHash) -> Result<WindConditions, Error> {
49
50
  Ok(WindConditions {
50
51
  speed: opt_f64(&w, "speed_mph", 0.0)? * MPH_TO_MPS,
51
52
  direction: opt_f64(&w, "direction_degrees", 0.0)? * DEGREES_TO_RADIANS,
53
+ // ballistics-engine 0.24.0 added vertical_speed (MBA-728); the Ruby `wind`
54
+ // sub-hash has no vertical-wind key yet, so leave it at the engine default (0.0).
55
+ ..Default::default()
52
56
  })
53
57
  } else {
54
- Ok(WindConditions {
55
- speed: 0.0,
56
- direction: 0.0,
57
- })
58
+ Ok(WindConditions::default())
58
59
  }
59
60
  }
60
61
 
@@ -119,12 +120,18 @@ fn extract_bc_segments_data(h: &RHash) -> Result<Vec<BCSegmentData>, Error> {
119
120
  Ok(out)
120
121
  }
121
122
 
122
- /// `wind_segments` = array of [speed_mph, angle_degrees, until_yards] -> (km/h, deg, meters).
123
- fn extract_wind_segments(h: &RHash) -> Result<Vec<(f64, f64, f64)>, Error> {
123
+ /// `wind_segments` = array of [speed_mph, angle_degrees, until_yards] -> engine
124
+ /// `WindSegment` (km/h, deg, meters). ballistics-engine 0.24.0 converted `WindSock` /
125
+ /// `TrajectorySolver::set_wind_segments` from `(f64, f64, f64)` tuples to this named
126
+ /// struct; keep the Ruby-facing arrays as plain 3-number triples and convert at the
127
+ /// boundary via `WindSegment::new`.
128
+ fn extract_wind_segments(h: &RHash) -> Result<Vec<WindSegment>, Error> {
124
129
  match h.lookup::<_, Option<Vec<(f64, f64, f64)>>>("wind_segments")? {
125
130
  Some(v) => Ok(v
126
131
  .into_iter()
127
- .map(|(mph, ang, until_yd)| (mph * MPH_TO_KMH, ang, until_yd * YARDS_TO_METERS))
132
+ .map(|(mph, ang, until_yd)| {
133
+ WindSegment::new(mph * MPH_TO_KMH, ang, until_yd * YARDS_TO_METERS)
134
+ })
128
135
  .collect()),
129
136
  None => Ok(Vec::new()),
130
137
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ballistics-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Jokela