根据不规则数据绘制表面 [英] Plot surface from irregular data

查看:63
本文介绍了根据不规则数据绘制表面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从分散的数据集中填充轮廓或曲面图.

I'm make a filled contour or surface plot from a scattered dataset.

与其他Qs的主要区别在于数据不是凸的.

A major difference from other Qs is that the data are not convex.

[r,th] = meshgrid(10:15,0:180);
[x,y] = deal(r.*sind(th), r.*cosd(th));
z = x.^2+y.^2;
scatter(x(:),y(:),[],z(:),'fill'); axis equal off;

内圈为空.

我用

tri = delaunay(x,y);
trisurf(tri,x,y,z);  view(2); axis equal off;

绘制表面图.

但是,正如您所看到的,内部圆是填充的.

However, as you can see, the inner circle is filled.

推荐答案

您将要使用

Rather than using the Delaunay triangulation which results in the convex hull, you're going to want to use an alphaShape with which you can impose a limit on the length of the resulting surfaces edges.

您可以指定 Alpha属性(通过指定第三个输入),它是最大边长的倒数.对于您的示例,我选择的Alpha为1.

A = alphaShape(x(:), y(:), 1);

然后您可以使用 alphaTriangulation alphaSurface对象的a>方法.

You can then get the triangulation out using the alphaTriangulation method of your alphaSurface object.

[faces, vertices] = A.alphaTriangulation();
zvalue = sum(vertices.^2, 2);

或者您可以使用alphaShape对象的plot方法

Or you can use the plot method of the alphaShape object

plot(A, 'FaceColor', 'interp', 'CData', zvalue)

这篇关于根据不规则数据绘制表面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆