Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67061

QEasingCurve::valueForProgress returns nan when control points are 1/3 apart

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.11
    • None

    Description

      The following should be a valid curve, but returns nan for any progress:

          QEasingCurve curve(QEasingCurve::BezierSpline);
          curve.addCubicBezierSegment(QPointF(1.0/3.0, 0.0), QPointF(1.0-1.0/3.0, 1.0), QPointF(1.0, 1.0));
          qDebug() << test.valueForProgress(0.35);
      

      The problem is that BezierEase::findTForX divides by factorT3, which is zero when the distance between the control points is 1/3 of the distance between the endpoints.

      There are also likely issues in cases where the points are distanced such that factorT3 = factorT2 = factorT1 = 0, or the equation is quadratic and the discriminant is less than zero.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              dragly Svenn-Arne Dragly
              dragly Svenn-Arne Dragly
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes