# Thread: Plotting 3d using non-grid data

1. Beginner Join Date
Feb 2013
Posts
4
Thanks
3
Qt products Platforms ## Plotting 3d using non-grid data

Does anyone know a qt (or c++) library supports plotting 3d plots using non grid data?

I tried qwtplot3d (using function loadFromData) but the output plot is not smooth.

What I need:
2.jpg

What I did
1.JPG

Thank you very much!  Reply With Quote

2. ## Re: Plotting 3d using non-grid data

Try using bilinear interpolation to resample your non-uniform data onto a regular uniform grid and then using that in qwtplot3d. I don't think qwtplot3d can handle non-uniform data. Wikipedia has a good discussion of bilinear interpolation.

Note that if your regular grid has larger unit spacing than the non-uniform data, then certain grid cells will contain more than one data point. When you do the interpolation, you add each of these contributions to the values at the four corners of the cell. You have to remember how many data points contribute to each grid point so at the end, you can divide the total sum by the number of contributions. If you don't you will get a spike at any grid point that has more than one data point contributing to it.

By the way, this is a pretty simple way to implement a "level of detail" feature: set the regular grid to a fixed, constant size in pixels (e.g. 1000 x 1000). As you zoom into your data, the number of data points in a grid cell will decrease, so the interpolated result shows a greater level of detail.  Reply With Quote

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

warcraff123456 (16th March 2013)

smooth;3d;plot 