From: Dennis den Ouden on
Dear dsv,

I had the same problem, but found the following solution:

Assume you have a non rectangular surface with coordinates X and Y and a function F in these points.

Also assume you have a set of points defining the boundary of your surface, call this LIN (for linear element).

First create an interpolation on rectangular mesh containing your surface:

[Xr,Yr,Fr] = griddata(X,Y,F,unique(X),unique(Y)');

(note the transpose at the end)

Then see which points from the rectangular grid [Xr,Yr] are inside your surface:

IN = inpolygon(Xr,Yr,X(LIN),Y(LIN));

Then set Fr to Nan at the points outside the surface:

Fr(~IN) = NaN;

Now use the standard CONTOURF function:

contourf(Xr,Yr,Fr)

Very nice results are obtained with:

contourf(Xr,Yr,Fr,200)
shading flat
colorbar

This can easily be compared with

trisurf(TRI,X,Y,F,'FaceColor','interp','EdgeColor','interp')
view(2)
colorbar

regards,

Dennis

dsv <deflagrator(a)gmail.com> wrote in message <7355be8e-2828-4d55-ada5-da689dd2e162(a)59g2000hsb.googlegroups.com>...
> I have a non-rectangular surface on which I want to construct filled
> contours similar to those produced by contourf. I have a triangular
> mesh on this surface, which enables me to view contours using
> tricontour that is obtainable from File Exchange. Anyone knows how to
> get filled contours?
>
> I tried trisurf, but I guess that is not what I want.
>
> dsv