Skip to content

fix(event-display): end track extensions on the requested radius - #1060

Merged
EdwardMoyse merged 1 commit into
HSF:mainfrom
G26karthik:fix-extend-to-radius
Nov 11, 2026
Merged

EdwardMoyse merged 1 commit into
HSF:mainfrom
G26karthik:fix-extend-to-radius

Conversation

@G26karthik

Copy link
Copy Markdown
Contributor

Closes #1059

RungeKutta.propagate moved the startPos and startDir vectors it was given. extrapolateFromLastPosition then removed points equal to the moved lastPos, so the last point of every extension was dropped: "Extend to radius" ended one step short, or added nothing when the last hit was within one step of it.

  • propagate now steps copies of startPos and startDir.
  • extrapolateFromLastPosition moves the end of the step that crosses the radius onto it (steps can be 1000 mm long), and returns nothing if the last hit already reaches it.
  • Its single-hit fallback direction now comes from a unit vector. With qop = 0, p is Number.MAX_VALUE and the direction came out as NaN or zero, which the copies in propagate would otherwise turn into null points.

Testing

jest --config configs/jest.conf.js src/tests/helpers/rk-helper.test.ts src/tests/helpers/runge-kutta.test.ts

  • Before: the 3 new tests fail (r = 995.3 instead of 1000; 0 points for a single-hit straight track; startPos moved).
  • After: all 11 pass, as do the helpers, loaders, ui-manager and scene-manager suites (251 tests). ESLint and Prettier are clean. I did not run the full yarn test:ci.
  • On 3,300 generated tracks, every extension crossing the radius now ends on it, within 9.8 mm of the exact helix crossing, and extrapolateTrackPositions output is unchanged.

RungeKutta.propagate kept the startPos and startDir vectors it was given
and moved them while stepping. extrapolateFromLastPosition then removed
points equal to the moved last hit, which dropped the step that crosses
the radius. So "Extend to radius" stopped one step short of the radius,
or added nothing when the last hit was within one step of it.

propagate now steps copies of the vectors. extrapolateFromLastPosition
moves the end of the crossing step back onto the radius, returns no
points when the last hit already reaches it, and builds the fallback
start direction from a unit vector, because p is Number.MAX_VALUE when
qop is 0 and the old direction came out as NaN or zero.
@github-actions

Copy link
Copy Markdown

🚀 Preview deployed: http://phoenix-pr-1060.surge.sh

Built from 50a7af3.

@EdwardMoyse
EdwardMoyse merged commit 03a05c3 into HSF:main Nov 11, 2026
4 checks passed
G26karthik added a commit to G26karthik/phoenix that referenced this pull request Nov 12, 2026
extrapolateTrackPositions built its start direction from a vector of
length p, and p is Number.MAX_VALUE when qop is 0. The vector
overflowed, so the direction came out as zero or NaN and the track
collapsed to a point or was dropped. Build it from a unit vector, as
was done for extrapolateFromLastPosition in HSF#1060.

This branch was successfully deployed

1 active deployment
pull-request — 50a7af3e Deployed Nov 10, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Extend to radius" stops one step short of the radius, or adds nothing near it

2 participants