Important: Please read the Qt Code of Conduct -

Create a colormap spectrum in Qt

  • Hi.
    I want to create a colormap with a set of points, each have a value. But my problem is that their position is not aligned to a grid, e.g somthing like this:
    Each circle is a point with known and constant location (x, y) which has some data (double z). but no other point in rectangle has any data and I should interpolate values for them.
    I looked into qcustomplot QCPColorMap and qwt QwtPlotSpectrogram but in both cases, there is a grid of points in rows and columns that has values.
    So I have two options:

    1. Ask GPU (via OpenGL) to interpolate colors between points (recommended option)
    2. 2D-interpolate whole area and feed that data to above-mentioned libraries

    Is this even possible to achieve option 1? If yes, how?
    If option one is not possible or too heavy (because I don't know opengl), how can I implement option 1?

    Thanks :-)

  • Might be overkill but Qt DataVisualisation should be able to do this no problem.

  • In my researches, I found this example
    a triangle with normalized coordinates between [-1,1] (obviously because of opengl, iirc) and a color for each corner is drawn, and color is interpolated in between.
    can I use the same technic with these points? something like below:
    with triangulating points and feed them to opengl, I want to have an interpolated and colored surface

Log in to reply