Skip to content

Fix renderSegment reversed range logic and align rounding behavior.#2245

Open
ej-sanmartin wants to merge 1 commit into
love2d:mainfrom
ej-sanmartin:fix/bezier-curve-unreachable-path
Open

Fix renderSegment reversed range logic and align rounding behavior.#2245
ej-sanmartin wants to merge 1 commit into
love2d:mainfrom
ej-sanmartin:fix/bezier-curve-unreachable-path

Conversation

@ej-sanmartin
Copy link
Copy Markdown

Fixes #2238


This PR fixes two issues in BezierCurve::renderSegment:

  • Reversed argument handling (start > end)
    The existing else if (end > start) branch was unreachable due to the
    preceding start < end check. As a result, calling renderSegment with
    reversed parameters returned the full curve instead of the intended subrange.
    The condition is corrected so reversed ranges now slice the proper segment.

  • Asymmetric rounding when slicing sampled vertices
    The forward and reversed paths previously used different rounding rules,
    causing renderSegment(a, b) and renderSegment(b, a) to select slightly
    different vertex ranges. Index calculation is now normalized so both cases
    refer to the same portion of the sampled curve.


Result

renderSegment now handles reversed arguments consistently and returns the
correct sub-curve in both orders, with stable and predictable indexing.

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.

Issue in BezierCurve->RenderSegment

1 participant