Repository navigation
Conversation
Three bugs in the Catmull curve implementation: 1. np.roll without axis=0 flattens the 2D points array before rolling, scrambling x/y coordinates when computing tangents. 2. Roll directions were swapped relative to variable names: np.roll(points, 1) shifts right (giving predecessors), but was assigned to p_aheads instead of p_behinds, producing negated tangents. 3. curve(0) returned the wrong position: math.ceil(0 * N) - 1 = -1 indexed the last segment instead of the first. Also, the global parameter t was used directly as the Hermite parameter s instead of being remapped to the local segment range [0, 1]. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…clamp Tests now verify against a reference implementation of osu's 4-point Catmull-Rom formula with the exact boundary logic from both osu-stable (SliderOsu.cs) and osu-lazer (PathApproximator.cs). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three bugs in the
Catmullcurve implementation that caused it to produce incorrect curve shapes compared to both osu-stable and osu-lazer:np.rollwithoutaxis=0: Flattens the 2D points array before rolling, scrambling x/y coordinates when computing tangents. All Catmull curves with 3+ points had incorrect tangent values.np.roll(points, 1)(shift right) was assigned top_aheadsinstead ofp_behinds, producing negated tangents.t=0:math.ceil(0 * N) - 1 = -1indexed the last curve segment instead of the first. Also, the global parametertwas used as the Hermite parametersinstead of being remapped to the local segment range[0, 1].v4 = v3 + (v3 - v2)), producing a tangent twice as large.Verified against osu-stable (
SliderOsu.cs+Vector2.CatmullRom) and osu-lazer (PathApproximator.CatmullToPiecewiseLinear+catmullFindPoint), which use the same 4-point formula and boundary logic.Test plan
slider/tests/test_curve.pywith tests that verify against a reference implementation of osu's exact Catmull-Rom formula and boundary handling🤖 Generated with Claude Code