Results 1 to 3 of 3

Thread: Using QwtPlot with int instead of double

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Using QwtPlot with int instead of double

    Hello!

    When drawing a curve (QwtPlotCurve, etc.) in a QwtPlot, one must provide an array of double values since QwtPlot itself uses double for coordinates (right?).

    But lets say that one of my graphs will never require such precision; instead, lets, say, I want a QwtPlot with 600 x 400 where each point will correspond exactly as one pixel on the screen and the scales will also consider integer, not float precision (lets say that the minimum values in both scales will be 0-1, never a 0-0.5 or the like). For such a situation, the usage of double seems only unnecessary loose of processing, such not only I'll have to convert my vector of int into a vector of double (in embedded situation that's a nicely avoidable loop!), but also all the calculations "inside" Qwt's system will also be in double when, as sad, I need only integer precision.

    If my assumptions are correct, is there a way to change this? Since all Qwt methods related to this consider double, this means I'ld have to edit the library, right? In this case, are there some considerations to pay attention to or it's just I matter of overloading the methods to use integer numbers?


    Thanks,

    Momergil
    May the Lord be with you. Always.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using QwtPlot with int instead of double

    When drawing a curve (QwtPlotCurve, etc.) in a QwtPlot, one must provide an array of double values since QwtPlot itself uses double for coordinates (right?).
    QwtPlotCurve is completely independent of how samples are stored. I explained the concept of QwtSeriesData many times ...

    Since all Qwt methods related to this consider double, this means I'ld have to edit the library, right?
    Better save your time not even trying it - you will never succeed. And as long as you don't have a CPU without a floating point unit I wouldn't see any benefits.

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    Momergil (27th May 2014)

  4. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Using QwtPlot with int instead of double

    Hello Uwe and thanks for the reply.

    Quote Originally Posted by Uwe View Post
    QwtPlotCurve is completely independent of how samples are stored. I explained the concept of QwtSeriesData many times ...
    Uwe
    Well, not sure how this answer the point The point of my comment wasn't to talk about "how" samples are stored, but if they use only double values or of other kind (such as int).

    Quote Originally Posted by Uwe View Post
    Better save your time not even trying it - you will never succeed. And as long as you don't have a CPU without a floating point unit I wouldn't see any benefits.
    Uwe
    that is the point I'm doing the work for a ARM processor (Texas' OMAP) that don't use a floating point unit :T So taking this into consideration plus the fact that floating values will never be shown on the interface plus the problem of limited processing, well then you may see it would have it's benefits if I could avoid double or float values as much as possible

    Any tip about how to best solve this problem if editing the library is not a viable option? Don't forget I'm using QwtPolarPlot as well


    Thanks,

    Momergil
    May the Lord be with you. Always.

Similar Threads

  1. Double click on the axes of qwtPlot ?
    By hassinoss in forum Qwt
    Replies: 2
    Last Post: 22nd May 2014, 08:41
  2. Program not finding an existing double in a QList<double>
    By aarelovich in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2011, 21:59
  3. double QwtPlot
    By mastupristi in forum Qwt
    Replies: 0
    Last Post: 9th July 2009, 14:25
  4. Replies: 2
    Last Post: 24th June 2009, 16:38
  5. Replies: 6
    Last Post: 14th May 2009, 13:02

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.