From 583288fafc80a71c35ed589b55eaf276f73eae9f Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 22 Dec 2025 18:00:20 +0000 Subject: [PATCH] Fix polar plot trajectory to only show during active passes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The trajectory line now only appears when the satellite is currently making the selected pass, fixing the confusing mismatch between the predicted path and real-time position. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- intercept.py | 41 ++++++++++++++++++++++++----------------- ± | 12 ++++++++++++ 2 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 ± diff --git a/intercept.py b/intercept.py index 6f04c65..6ee5333 100755 --- a/intercept.py +++ b/intercept.py @@ -13810,27 +13810,34 @@ def satellite_dashboard(): ctx.fillText(l.text, x, y); }); - // Draw pass trajectory if available + // Draw pass trajectory only if the pass is currently happening if (passes.length > 0 && selectedPass !== null && passes[selectedPass]?.trajectory) { const pass = passes[selectedPass]; - ctx.strokeStyle = color; - ctx.lineWidth = 2; - ctx.setLineDash([8, 4]); - ctx.globalAlpha = 0.5; - ctx.beginPath(); + const passStart = new Date(pass.startTimeISO); + const passEnd = new Date(passStart.getTime() + (pass.duration || 10) * 60 * 1000); + const now = new Date(); - pass.trajectory.forEach((pt, i) => { - const r = radius * (1 - pt.el / 90); - const angle = (pt.az - 90) * Math.PI / 180; - const x = cx + r * Math.cos(angle); - const y = cy + r * Math.sin(angle); + // Only show trajectory if pass is currently active + if (now >= passStart && now <= passEnd) { + ctx.strokeStyle = color; + ctx.lineWidth = 2; + ctx.setLineDash([8, 4]); + ctx.globalAlpha = 0.5; + ctx.beginPath(); - if (i === 0) ctx.moveTo(x, y); - else ctx.lineTo(x, y); - }); - ctx.stroke(); - ctx.setLineDash([]); - ctx.globalAlpha = 1; + pass.trajectory.forEach((pt, i) => { + const r = radius * (1 - pt.el / 90); + const angle = (pt.az - 90) * Math.PI / 180; + const x = cx + r * Math.cos(angle); + const y = cy + r * Math.sin(angle); + + if (i === 0) ctx.moveTo(x, y); + else ctx.lineTo(x, y); + }); + ctx.stroke(); + ctx.setLineDash([]); + ctx.globalAlpha = 1; + } } // Draw current satellite position diff --git a/± b/± new file mode 100644 index 0000000..97e6663 --- /dev/null +++ b/± @@ -0,0 +1,12 @@ + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# Committer: James Smith +# +# On branch main +# Your branch is up to date with 'origin/main'. +# +# Changes to be committed: +# modified: intercept.py +#