#162 QwtInterval does not handle NaN values

Brian Sipos

I have been using the QwtRasterData::contourLines() function to get contours from some data functions, and ran into an issue when the raster data is NaN-valued. At the edge of the function domain where the values are NaN on one side and finite on another, I am seeing zigzag contour lines being generated. I attempted to resolve this by using the QwtRasterData::IgnoreOutOfRange flag with some finite interval, but QwtInterval::contains() always returns true if the interval is valid and the test value is NaN. Because NaN always compares false against any other value, the test logic does not make sense here.

I suggest a NaN check the same way there is a QwtInterval::isValid() check (see attached patch), or at least a similar check within the QwtRasterData::contourLines() function to avoid the out-of-range contour lines.


  • Brian Sipos

    Brian Sipos - 2012-05-23

    A change to handle NaN values

  • Uwe Rathmann

    Uwe Rathmann - 2013-09-01
    • status: open --> closed
    • Group: -->
  • Uwe Rathmann

    Uwe Rathmann - 2013-09-01

    qIsNaN() is an "expensive" operation I don't want to have inside QwtInterval - like you don't find such checks in QPointF/QRectF.

    But as NaN has a valid meaning for QwtRasterData I added a check for NaN here. Fixed in SVN 6.1 and trunk.



Cancel  Add attachments