Skip to content

Introduce curve.totalLength#5699

Merged
Grantim merged 3 commits intomasterfrom
fix_periodic_curve_bending
Feb 12, 2026
Merged

Introduce curve.totalLength#5699
Grantim merged 3 commits intomasterfrom
fix_periodic_curve_bending

Conversation

@Grantim
Copy link
Contributor

@Grantim Grantim commented Feb 12, 2026

  • CurveFunc argument is now expected [0,totalLength)
  • Bend function: curve time now has same "space" for stretched and non-stretched mode
  • Remove unitLength argument from some functions because it is not longer needed

 - CurveFunc argument is now expected [0,totalLength)
 - Bend function: curve time now has same "space" for stretched and non-stretched mode
 - Remove `unitLength` argument from some functions because it is not longer needed
@Grantim Grantim requested a review from Fedr February 12, 2026 15:32
if ( params.periodicCurve )
curveTime = curveTime - std::floor( curveTime );
const auto pos = curve( curveTime );
curveTime = std::fmodf( curveTime, curve.totalLength );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not work for negative curveTime

/// given a polyline by its vertices, returns curve function representing it;
/// return an error if the polyline is less than 2 points or all points have exactly the same location
/// \param unitLength if true, then the lengths are normalized for the last point to have unit length
/// \param outCurveLen optional output of the total polyline length (before possible normalization)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// \param outCurveLen optional output of the total polyline length (before possible normalization)
/// \param outCurveLen optional output of the total polyline length

@Grantim Grantim merged commit 7cb23ed into master Feb 12, 2026
34 checks passed
@Grantim Grantim deleted the fix_periodic_curve_bending branch February 12, 2026 17:29
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.

2 participants