From 202106551c3a495333bd945886d2e299ba0a1780 Mon Sep 17 00:00:00 2001 From: JoshuaWol Date: Mon, 23 Feb 2026 21:36:57 -0800 Subject: [PATCH] Fix hit detection condition in trajectorycalc.py Adjust hit detection logic for trajectory calculations. --- ALt-Trajectories/trajectorycalc.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ALt-Trajectories/trajectorycalc.py b/ALt-Trajectories/trajectorycalc.py index aacc8ea..d270d02 100644 --- a/ALt-Trajectories/trajectorycalc.py +++ b/ALt-Trajectories/trajectorycalc.py @@ -43,7 +43,7 @@ def calc_distances() -> list[tuple[float, float, float]]: if z>target_z: prev_hit_z = True - if prev_hit_z and z list[tuple[float, float, float]]: v_x += accel_x * dt v_z += accel_z * dt + prev_x = x + prev_z = z + x += v_x * dt z += v_z * dt t += dt @@ -63,10 +66,13 @@ def calc_distances() -> list[tuple[float, float, float]]: missed = True if hit: + if not math.isclose(z,target_z, rel_tol = 0.0005): + x = x - (x - x_prev) * (z - target_z) / (z - z_prev) result.append((x, math.degrees(theta_i), vi)) + return result