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 qcustomplotQCPColorMap
and qwtQwtPlotSpectrogram
but in both cases, there is a grid of points in rows and columns that has values.
So I have two options:- Ask GPU (via OpenGL) to interpolate colors between points (recommended option)
- 2D-interpolate whole area and feed that data to above-mentioned libraries
So:
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 :-)
-
In my researches, I found this example https://doc.qt.io/qt-5/qtgui-openglwindow-example.html
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