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 +4 -4
- data/Cargo.lock +2 -2
- data/Cargo.toml +1 -1
- data/lib/ballistics_engine.rb +1 -1
- data/src/lib.rs +14 -7
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f01d0ad0ea0ef3b70c1d6ff2eb9a19b11604c9d849ed460a108b62dd03a42168
|
|
4
|
+
data.tar.gz: 8addfb5018331b89eda7704cc3aada03a0ca983eec6d7803f3238c2e00f15c2b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
96
|
+
version = "0.24.0"
|
|
97
97
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
98
|
-
checksum = "
|
|
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.
|
|
18
|
+
ballistics-engine = { version = "0.24.0", default-features = false }
|
|
19
19
|
magnus = "0.8"
|
|
20
20
|
|
|
21
21
|
[profile.release]
|
data/lib/ballistics_engine.rb
CHANGED
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] ->
|
|
123
|
-
|
|
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)|
|
|
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
|
}
|