I have a set of isoline points (or contour points) such as this:
Each point on an isoline has its own respective X, Y, and Z coordinate. Since they are isolines, that means that each point will have a unique X-Y pair, but points on the same line will have the same Z coordinate.
Now, is there any algorithm or any software packages (either in C# or C++ or MATLAB) that I can use to interpolate the isoline points into a full 3-D surface?
P/S: I am not just interested in the final output, I am interested in getting the interpolated surface data so that I can plot the surface myself.
Edit: C++ solutions are welcomed as well.

In MATLAB you can use either the function
griddataor theTriScatteredInterpclass (Note: as of R2013ascatteredInterpolantis the recommended alternative). Both of these allow you to fit a surface of regularly-spaced data to a set of nonuniformly-spaced points (although it appearsgriddatais no longer recommended in newer MATLAB versions). Here’s how you can use each:griddata:where
x,y,zeach represent vectors of the cartesian coordinates for each point (in this case the points on the contour lines). The row vectorXIand column vectorYIare the cartesian coordinates at whichgriddatainterpolates the valuesZIof the fitted surface. The new values returned for the matricesXI,YIare the same as the result of passingXI,YItomeshgridto create a uniform grid of points.TriScatteredInterpclass:where
x,y,zagain represent vectors of the cartesian coordinates for each point, only this time I’ve used a colon reshaping operation(:)to ensure that each is a column vector (the required format forTriScatteredInterp). The interpolantFis then evaluated using the matricesXI,YIthat you must create usingmeshgrid.Example & Comparison
Here’s some sample code and the resulting figure it generates for reconstructing a surface from contour data using both methods above. The contour data was generated with the
contourfunction:Notice that there is little difference between the two results (at least at this scale). Also notice that the interpolated surfaces have empty regions near the corners due to the sparsity of contour data at those points.