|
From: <fic...@gm...> - 2006-12-04 18:39:55
|
Hello everyone,
I tried to find another simple example for loading z-values, but I
didn't find one. It would be great if someone would be so kind to mail a
small example, that creates a plot just like the one in the "simple
plot"-example, but with precomputed z-values.
I'm also not sure which subclass of Plot3D is best for this purpose.
The background of my question is, that I'm using the CImg-library (maybe
someone knows this lib) for the image processing algorithms and I want
to display some 2D image data as 3D plots. Here is an extract of what I
tried so far (I used a lot of the simpleplot example here):
The header file:
#ifndef FSURFACEPLOT_H_
#define FSURFACEPLOT_H_
#include <math.h>
#include <qapplication.h>
#include <qwt3d_surfaceplot.h>
#include <qwt3d_function.h>
#include "CImg.h"
using namespace Qwt3D;
class FSurfacePlot : public SurfacePlot
{
public:
FSurfacePlot(cimg_library::CImg<>& data);
};
#endif
And the source file:
#include "FSurfacePlot.h"
FSurfacePlot::FSurfacePlot(cimg_library::CImg<>& data)
{
setTitle("Time-space image");
int columns = data.dimx();
int rows = data.dimy();
double** newdata = new double* [columns];
for( int i = 0; i < columns; ++i)
newdata[i] = new double[rows];
for(int i = 0; i < columns; i++)
{
for(int j = 0; j < rows; j++)
{
newdata[i][j] = data(i,j);
}
}
loadFromData(newdata,columns,rows,1,columns,1,rows);
setRotation(30,0,15);
setScale(1,1,1);
setShift(0.15,0,0);
setZoom(0.9);
for (unsigned i=0; i!=coordinates()->axes.size(); ++i)
{
coordinates()->axes[i].setMajors(7);
coordinates()->axes[i].setMinors(4);
}
coordinates()->axes[X1].setLabelString("x-axis");
coordinates()->axes[Y1].setLabelString("y-axis");
//coordinates()->axes[Z1].setLabelString(QChar(0x38f)); // Omega -
see http://www.unicode.org/charts/
setCoordinateStyle(BOX);
updateData();
updateGL();
}
Everything compiles without errors, but when the widget is shown, I just
see a black window with a wireframe box, whose colors are changing in a
weird way.
Maybe you can tell me, where I'm thinking wrong or give me some other
clues!?
Best regards!
Florian
|